PHP replace href
Posted: Fri Jul 02, 2010 4:51 pm
Hi,
I need to find and replace regex code for php.
I need to replace all HREF in A tags,
eg. href="index.html" to href="http://mysite.com/site=http://the_user_ ... index.html"
I can get the href using preg_match_all:
I need to do it with preg_replace.
any help will be appreciated.
I need to find and replace regex code for php.
I need to replace all HREF in A tags,
eg. href="index.html" to href="http://mysite.com/site=http://the_user_ ... index.html"
I can get the href using preg_match_all:
Code: Select all
preg_match_all("/<\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"' >]/i", $content, $match);any help will be appreciated.