Hello!! i want to grab all content that is between the tags <-- message --> and <!-- message -->.. I have found the right pattern to do so which is something like preg_match_all('%<!-- message -->(.+)<!-- / message -->%si',$x,$y) but it seems that it grabs all content from the 1st tag <-- message --> untill the last tag <!-- message --> in one record. However, there are many more such tags between the first and the last encounter and the thing is that i want to fill my array with all this records separately..Any ideas???
.+ is greedy add ? to make it ungreedy (or use the U modifier), preg_match_all('~<!\-\- message \-\->(.+?)<!\-\- / message \-\->~si', $x, $y); PHP: Also escape/backslash the - character as its considered a special character within regex.