Modified: Mathcing newline?
Posted: Wed Nov 08, 2006 11:18 pm
Attempt 1:
Attempt 2:
The above regex is supposed to match all the source code between <?php and optionally ?> hopefully returning an array of PHP tags inside any text document.
I can't figure out how to get the regex to match PHP tags which span multiple lines???
Also if you can see anything wrong with it (other than it ignores <script> <? or <% tags) please let me know
Cheers
Code: Select all
preg_match_all('/<\?php(\S|.)*\?>?/', $buff, $php);Code: Select all
preg_match_all('/<\?php([\s\S])*\?>?/', $buff, $php);I can't figure out how to get the regex to match PHP tags which span multiple lines???
Also if you can see anything wrong with it (other than it ignores <script> <? or <% tags) please let me know
Cheers