Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to ignore case in preg_match_all usage

Im trying to crape html and grab items between <tr> tags. Some of the tags are coming through as uppercase for some reason ( <TR> ) and are being ignored by my pattern. How can i tell my pattern to ignore case.

My current pattern is:

preg_match_all("|<tr(.*)</tr>|U",$table,$rows);
like image 544
user1243021 Avatar asked Dec 29 '25 20:12

user1243021


1 Answers

You'll need to use the i modifierDOCS:

preg_match("|<tr(.*></tr>|Ui", ...);
like image 53
Linus Kleen Avatar answered Jan 01 '26 08:01

Linus Kleen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!