Re: highlight_string()
| From: | Robin Vickery | Date: | Fri, 10 Mar 2006 11:24:42 +0000 |
| Subject: | Re: highlight_string() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231758@lists.php.net to get a copy of this message | ||
On 10/03/06, Weber Sites LTD <berber@weber-sites.com> wrote:
> Hi
>
> I'm trying to go with your idea but I'm having difficulties with
> preg_match_all.
> I want the text between <?php and ?>. The use of preg_match_all bellow only
> Returns text that is in a single line. If the <php is on one line and the ?>
> is
> A few lines bellow, it does not match.
>
> preg_match_all('/<\?php(.*?)\?>/i',$text,$CodeArray,PREG_PATTERN_ORDER);
>
By default a '.' matches any character except for a newline. If you
want it to match *everything* you have to use the 's' pattern modifier
- just stick an 's' on the very end of your pattern, after the 'i'.
/<\?php(.*?)\?>/is
-robin