Re: regex
| From: | Robin Vickery | Date: | Thu, 14 Sep 2000 14:49:56 +0000 |
| Subject: | Re: regex | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16782@lists.php.net to get a copy of this message | ||
monte@ispi.net (Monte Ohrt) writes:
>
> Alan Morey wrote:
> >
> > i'm using
> >
> > eregi("<[^>]*>", $string) to match all html tags how can i get it to
> > ignore
> > php tag <? ... ?> ?
> >
>
> eregi("<[^?][^>]*>", $string)
>
<?php if ($foo == $bar && $baz == $wibble) { print "Wow! Coincidence or what?";
} ?>
If you're allowing arbitrary php code in your string, bear in mind that your
regex will match things like the '< $bar && $baz >' in this snippet.
-robin
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444