Re: Quick regular expressions question / preg_replace
| From: | Bogdan Stancescu | Date: | Sat, 05 Jan 2002 02:20:19 +0000 |
| Subject: | Re: Quick regular expressions question / preg_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79519@lists.php.net to get a copy of this message | ||
I suck big time at regular expressions, but have you tried
str_replace("\r\n<html>\r\n", '', $string); ?
Bogdan
David Yee wrote:
> Hi guys. Quick regular expressions question here:
>
> I want to match:
>
> <html>
>
> but not:
>
> blah blah <html>
>
> Basically I want to wipe out lines beginning with the <html> tag followed
> immediately by a carriage return. If I do a:
>
> str_replace("<html>\r\n", '', $string);
>
> It wipes out <html> and the carriage return after blah blah <html>. So I
> suppose I have to turn to preg_replace, but I'm having a hard time coming up
> with the right pattern. Thanks.