javascript regex: replace url text link with image,but not in html tags

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2009-09-08T23:13:19Z Indexed on 2010/03/16 7:06 UTC
Read the original article Hit count: 379

Filed under:
|
|
|

Hi this is my pice of code:

                    <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

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript