Using Regex to modify a String
Posted
by
Christine Dehner
on Stack Overflow
See other posts from Stack Overflow
or by Christine Dehner
Published on 2012-09-03T03:25:05Z
Indexed on
2012/09/03
3:38 UTC
Read the original article
Hit count: 329
JavaScript
|regex
I have a String that looks like this:
Blah blah one.<tmp>[[url=b, link=c]]</tmp> Blah blah two.
Also remember, blah blah three.<tmp>[[url=d, link=e]]</tmp>
So I want to get b and d (the url attribute of tmp), and change the String so that it looks like this (the ex() function returns a String):
Blah blah one.<tmp>[[url=b, link=c, add=ex(b)]]</tmp> Blah blah two.
Also remember, blah blah three.<tmp>[[url=d, link=e, add=ex(d)]]</tmp>
I need to use regex because no existing library parses this type of markup.
I hope my explanation is clear.
Thanks in advance!
© Stack Overflow or respective owner