Search and Replace a Part of a Regular Expression
Submitted by Tuesday, 22 June, 2004 - 20:36
on
How would one replace only a portion of a regular expression match? For example, I have lots of entries in my html that have been typed in like.. <a href="http://www.fxweb.holowww.com/tracker/"> WebTracker</a> Web visitor tracking software <br /> and I want to reformat them all to look like.. <a href="http://www.fxweb.holowww.com/tracker/"> WebTracker</a> Web visitor tracking software <br /> My Search: </a>\s*[^<] in the above case matches: </a> \n W which I want to replace with: </a> W How do I grab the W or any other letter that is found by the regular expression term [^<] in order to put it back into the Replace phrase? How do positional parameters work?