English 中文(简体)
Javascript regex:取而代之的是卢尔文与图像链接,而不是在html的标签上。
原标题:Javascript regex: replace url text link with image,but not in html tags
  • 时间:2009-09-08 23:13:19
  •  标签:

然而,这是我的法典ice:

                    <div style="overflow: hidden; width: 445px;">[IMG]http://i29.tinypic.com/mydog.png[/IMG] tak si to http://i29.tinypic.com/mycat.png  Lorem ipsum loremai <img width="15" border="0" align="middle" src="images/smejo.gif" valign="middle"/> <img src=http://www.example.com/index.png alt> <img src="http://www.example.com/index.png" alt>     <a href="#reakcia" title="reagovat na temu"><span class="poradna-tl-reaguj"><reaction> </span></a></div>
        </td>           </tr><img src=http://www.example.com/index.png alt><img src="http://www.example.com/index.png" alt>

and i need regex pattern to replace ONLY text image links with image without touch of inner url tags. But i can t use "Lookbehind" or possessive quantifiers because JS don t support them=/ So i want to catch only "http://i29.tinypic.com/mydog.png" and "http://i29.tinypic.com/mycat.png".

I using array method to replacing (will be greasemonkey script.) Many Thanks

问题回答

......整一天一天天,现在几分钟后,就解决了这个问题。

答复

((?:(?:https?|ftp|file)://|www.|ftp.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$]+.(jpg|png|gif|jpeg|bmp))(?!([^<]+)?>)




相关问题
热门标签