Using Regex to modify a String
- by Christine Dehner
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!