Regular Expression Query
| From: | Cybercandy Ltd | Date: | Sat, 06 Jan 2001 18:27:07 +0000 |
| Subject: | Regular Expression Query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-33040@lists.php.net to get a copy of this message | ||
I think the most difficult thing I've encountered so far in trying to
learn PHP, as a novice programmer, is regular expressions.
I'm trying to use ereg_replace on a string containing a large quantity
of data taken from a webpage which I then parse using
the explode function.
One regularly occuring string is: (Reference #xxx)
Where xxx is a number of up to 3 digits.
I want to replace this string using back references to just xxx
and I've tried using the following:
$out = ereg_replace("\(Reference #.([0-9]+).\)","\\1",$in);
I just can't suss why this doesn't work.
Any pointers anyone?
Allan
www.cybercandy.co.uk