Regular Expression help?
Date: 01/16/06
(PHP Community) Keywords: no keywords
Hi guys,
Following up on my previous post, I've managed to get the array to filter using preg_grep().
But I need some help on my regular expressions. I've currently got it as $regexp = "/".$_POST['cityname']."/"; which matches any instance of 'cityname'. The problem here is that the regular expression is case sensitive, and I need it to ignore cases.
I would use strtoupper or strtolower, but the array values are in Natural case. I think I should use an (i) in the regexp to allow it to ignore case, but I'm not sure where to fit it in. Can someone help me out?
SOLVED: $regexp = "/".$_POST['cityname']."/i";
Source: http://community.livejournal.com/php/395374.html