Log in

View Full Version : PCRE Help



My220x
05-23-2009, 12:47 PM
I am new to PCRE in PHP and understand the basic patterns however the ones below are a bit complex and I don't understand what the following pattern matches:


$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#... "<a href='' rel='nofollow'></a>", $ret);

$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*... "<a href='http://' rel='nofollow'></a>", $ret);


Could someone please explain and link me to some good tuts. Thanks.

My220x
05-24-2009, 12:00 PM
No replies, is anyone good at PCRE here? :D

It doesn't matter anyway now :) I worked out the first one matches a url with :// in it and the second one matches a url with www. or ftp.