Maybe you should use

/\b/

word boundary

instead of all the or's

Joshua Moore-Oliva wrote:

I'm kind of confused right now... when I call preg_replace_callback with a regular expression with brackets, sometimes I get an array back with multiple elements like

array(3) {
 [0]=>
 string(19) "http://www.aol.com
"
 [1]=>
 string(0) ""
 [2]=>
 string(19) "http://www.aol.com
"
}

and I have no idea why... Why does the middle one have nothing in it? the regular expression was

$dumb_body = preg_replace_callback ( '/'
//Case spaceURLspace
. '([\s]http:\/\/[^\s]+[\s])'
. '|'
//Case URLspace
. '(^http:\/\/[^\s]+[\s])'
. '|'
//Case spaceURL
. '([\s]http:\/\/[^\s]+$)'
. '|'
//Case URL
. '(^http:\/\/[^\s]+$)'
. '/i'
, array( &$this, "storeUrlCallback" ), $dumb_body );


I am very confused at the point of the array in this function period... can anyone help?

Josh.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to