I'm just gonna make a list:
.
does not match newlines unless PCRE_DOTALL (the/s
flag) is used.For
preg_split
you also need thePREG_SPLIT_DELIM_CAPTURE
option to not just get rid of the matched parts.In your case you better should use
preg_match_all
instead ofpreg_split
.
And lastly, in anticipation of your next question, your expression did not match your source:
...>|<script type="text/javascript>.*?<....
^
In conclusion, better use something like:
preg_match_all("~( <script[^>]*> (.*?) </script> )~smix", $src, ...