Re: What's wrong with this regex?
| From: | Jason Wong | Date: | Sun, 04 Aug 2002 20:42:02 +0000 |
| Subject: | Re: What's wrong with this regex? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111092@lists.php.net to get a copy of this message | ||
On Monday 05 August 2002 04:30, Nicklas af Ekenstam wrote:
> Hi
>
> I'm going crazy over this problem so once again I turn here for help.
> Here's the problem:
>
> I have this script:
>
> <?php
> $body = "This is some text http://www.php.net/
> www.zend.com yes no redblue.
> An ftp-server: ftp://php.net:21/ abc def 123 - test. ";
>
> eregi("(((https?|ftp|gopher)://|(mailto|file|news):)[^'<>"]+|(www|web|w3).[
The double-quote here should be escaped with \ ^
>-a-z0-9.]+)[^' .,;<>":]", $body, $urls); print_r($urls);
ditto ^
> Here's the output I get:
>
> Parse error: parse error, unexpected ']' in test.php on line 2
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"A great many people think they are thinking when they are merely rearranging
their prejudices."
-- William James
*/