I'm trying to rewrite this URL:
http://www.mysite.com/index.php?topic=54.msg432#msg432
to this one:
http://www.mysite.com/index.php?thread=54&post=432
using preg_replace. I tried this:
echo preg_replace('|http?://www\.mysite\.com/index.php/topic=(\d)|', '\1',
'http://www.mysite.com/index.php?topic=54.msg432#msg432');
And i can't get the thread :( I tried with the manual but php pattern is confusing. Im used to python RE patterns...
This doesn't work neither
php -r "echo preg_replace('~\?topic=(\d+).msg(\d+)~', '?thread=$1&post=$2', 'http://www.mysite.com/index.php?topic=54.msg432#msg432');"
result:
http://www.mysite.com/index.php?thread=&post=#msg432
Also, i'll appreciate a good php pattern manual.
Thanks