Page 1 of 1

How do I ignore casing in Preg_match?

Posted: Thu Mar 31, 2016 10:44 am
by simonmlewis

Code: Select all

if (preg_match('/t shirt/', $row->description))
{  
echo "Description: T Shirt<Br/>";
}
I'm trying to see how to find t shirt and T Shirt in a field. I've heard of the "i modifier" but don't know how to implement it in my code... or if there is a better way to run this query. So far I have over 200 results, so anything to make it better would be good too.

Thanks.

Re: How do I ignore casing in Preg_match?

Posted: Thu Mar 31, 2016 11:31 am
by Celauran

Code: Select all

preg_match('/pattern/i', $variable);