Please help I am working for more than 3 hours now this problem but I can't think or find way to correct it... my regular expression is like this %<h[^>]+>(.*)</h.>%i It works perfectly if the string look like this <H1><A NAME="SECTION000300000000000000000">2 Simple Patterns</A></H1> Code (markup): Result : <A NAME="SECTION000300000000000000000">2 Simple Patterns</A></H1> But if string will look like this <H1><A NAME="SECTION000300000000000000000">2 Simple Patterns </A> </H1> Code (markup): Result : None I guess the problem is the line break or not sure.. Thanks in advance
try giving m modifiers %<h[^>]+>(.*)</h.>%im m - Treat string as multiple lines i - Case-insensitive match
Hi, It seems preg_match treat such string as an array and array elements don't match the regexp. Proof: $s='<H1><A NAME="SECTION000300000000000000000">2 Simple Patterns </A> </H1>'; $arr=array(); preg_match_all('#.*#',$s,&$arr); print_r($arr); PHP: So you can replace "\r\n" for the input with "". Regards