[Q] Regex Woes
| From: | Michael T. Peterson | Date: | Sun, 18 Jul 2004 21:29:45 +0000 |
| Subject: | [Q] Regex Woes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-190935@lists.php.net to get a copy of this message | ||
All,
This should be dirt simple -- So simple, in fact, that I'm somewhat
embarassed to make this post, but, oh well....
I need to find all lines that begin with the string 'WAZ' after reading from
a url (http://www.atmos.washington.edu/data/zone_report.KSEW.html). While
I've tried every combination of expressions under the sun (using the
functions preg_match(), ereg()), I can not figure out a correct regexp for
this task.
I trim each line before submitting to preg_match() or ereg(). I also strip
out the tags except for <p> and <br>.
Would some kind sould show me the correct regexp?
By the way, one of the simplest expressions, to follow the suggestion in the
PHP Manual, is just '/WAZ/' or '/^WAZ/'. The former doesn't match
"WAZ"
anywhere in the string, and the latter doesn't find a match when "WAZ" is at
the beginning of the string.
Cheers,
Michael