小编Asa*_*off的帖子

正则表达式语法问题 - 试图理解

我是一名自学成才的PHP程序员,我现在才开始掌握正则表达式的东西.当它正确完成时,我非常清楚它的功能,但这也是我需要深入研究的.所以也许有人可以帮助我,并节省我这么多小时的实验.

我有这个字符串:

here is the <a href="http://www.google.com" class="ttt" title="here"><img src="http://www.somewhere.com/1.png" alt="some' /></a> and there is <a href="#not">not</a> a chance... 
Run Code Online (Sandbox Code Playgroud)

现在,我需要使用preg_match此字符串并搜索a href其中包含图像的标记,并将其替换为具有较小差异的相同标记:在标记内的title属性之后,我将要添加rel="here"属性.当然,它应该忽略里面a href没有img标签的链接('s).

php regex

1
推荐指数
1
解决办法
104
查看次数

标签 统计

php ×1

regex ×1