Re: strings
| From: | Curt Zirzow | Date: | Sat, 02 Aug 2003 02:38:11 +0000 |
| Subject: | Re: strings | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158032@lists.php.net to get a copy of this message | ||
* Thus wrote Anthony Ritter (tony@gonefishingguideservice.com):
> Curt Zirzow wrote in message:
>
> > This exact thing was talked about earlier today, with the subject
> > 'Using eregi_replace()'.
> ........................
>
> Right.
>
> However, I've tried using the following code in which the text from the URL
> is printed out completely and then I change the variable from $contents to
> $text and using the line with preg_replace(), it still outputs the complete
> text without the pattern match.
hm.. I sort of misunderstood, preg_replace isn't what you need. use
preg_match instead.
I did some testing you can see the code and results here:
http://zirzow.dyndns.org/html/php/tests/preg/parse_doc.php
> $newtext= preg_replace("!.*?(REGIONAL.*YORK).*!","$1",$text);
btw, there these should be single quotes ~~~~~~~~~~^ ^
or "\$1" so php doesn't expand the variable (even though its an
illagal php var name.)
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."