Regular expression replace a word by a link

Posted by AnhTu on Stack Overflow See other posts from Stack Overflow or by AnhTu
Published on 2008-11-09T15:42:55Z Indexed on 2010/03/08 15:36 UTC
Read the original article Hit count: 497

Filed under:
|
|

I want to write a regular expression that will replace the word Paris by a link, for only the word is not ready a part of a link.

Example:

    i'm living <a href="Paris" atl="Paris link">in Paris</a>, near Paris <a href="gare">Gare du Nord</a>,  i love Paris.

would become

    i'm living.........near <a href="">Paris</a>..........i love <a href="">Paris</a>.

© Stack Overflow or respective owner

Related posts about regex

Related posts about replace