What's wrong with this regular expression?
| From: | James Crowley | Date: | Fri, 20 Jul 2001 18:26:30 +0000 |
| Subject: | What's wrong with this regular expression? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-58953@lists.php.net to get a copy of this message | ||
Hi,
Could someone please point out where I've gone wrong with this regular
expression...?
$body="<a href=\"http://www.fred.com\">my test</a> or <a
href=\"/show.asp?id=333\">here</a>";
$body=eregi_replace ("<a
href=\"([^\\[]*)\">([^\\[]*)</a>","[url=\"\\1\"]\\2[/url]",$body);
#$body should now be
[url="http://www.fred.com"]my test[/url] or
[url="/show.asp?id=333"]here[/url]
#but instead, it is
[url="http://www.fred.com">my test</a> or
<a
href=\"/show.asp?id=333\"]here[/url]
echo $body;
Thanks
- James
Editor, VB Web
==================
Web - http://www.vbweb.co.uk
Email - james@vbweb.co.uk
ICQ# - 60612011
Fax - +44(0)8707052859
==================