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://www.livejournal.com/community/php/395374.html

« Embedded PHP || PHP Frameworks »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home