Regex Matching
| From: | Andrew Rush | Date: | Thu, 08 Feb 2001 18:23:20 +0000 |
| Subject: | Regex Matching | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38795@lists.php.net to get a copy of this message | ||
in Perl, i do thusly:
$adtext = "This is a {test} john.smith\@mail.mainetoday.com";
$email = $1 if($adtext=~/(\{.*\})/);
print "email = $email\n\n";
and i get back "email = "test".
i then do thusly in PHP:
$f=fopen($test_name, "r");
while(!feof($f)) {
$line=fgets($f,
4096);
preg_match_all("/(\{.*\})/", $line, $holes);
}
after this $holes contains the number of elements i expect to get back, but has no values. any ideas
what i am doing wrong?
:: Andrew Rush :: Lead Systems Developer :: MaineToday.com ::
**************************************************************************
"Crippled but
free, blind all the time, i was learning to see"
- J. Garcia / R. Hunter
**************************************************************************
The views expressed
herein are not necessarily those of my employer, but
they let me have them anyway.