Regular expression problem (PHP)
- by Marcos
Hello all. I have a little problem with my regular expression, that I use in PHP. My code identify all tags of my content and add a link in this image. My code is working when I use dinamycally, without any defined image. When I try with a imapge path, the code does not work. How can I solve this problem?
Working code:
$content = preg_replace('/(<img .*?src="(.+?)".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content);
Problem code:
$content = preg_replace('/(<img .*?src="ttp://mysite.com/files/2010/04/bac-gallery-site-matters-saline-project1.jpg".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content);