What's wrong with this regex?

From: Date: Sun, 04 Aug 2002 20:30:21 +0000
Subject: What's wrong with this regex?
Groups: php.general 
Request: Send a blank email to php-general+get-111091@lists.php.net to get a copy of this message
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).[-a-z0-9.]+)[^' .,;<>":]", $body, $urls); print_r($urls); ?> Which supposedly should find the urls in the variable $body and throw them into the array $urls. The regular expression I use is the same one used in the program urlview (man urlview) which accompanies most installations of the email program mutt. Here's the output I get: Parse error: parse error, unexpected ']' in test.php on line 2 I'm not to good with php vs. regexps so no matter how much I try I can't seem to get it to work. Any help is greatly appreciated. - Nicklas

« previous php.general (#111091) next »