I'm trying to find everything between either <?php or <? and ?> in html files with phps preg_match_all() function. I've tried all kinds of stuff and run into a problem that preg_match won't match a string if it's on different lines.
(Since I've had such problems with this, I gave up on the <? and just stuck with the <?php).
So
preg_match_all("/<\?php(.*)\?>/i", $string, $matches);
will only match stuff if the <?php and the ?> are on the same line.Then I discovered single line mode and so the regex became "/<\?php(.*)\?>/is" and that will match when the <?php and the ?> are on different lines...but not when they're on the same line.
Can someone help me create a regex that will match either case? where the <?php and the ?> are on the same or on different lines?
Thanks,
John
--------------------
BYU Unix Users Group http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
