i need to find and replace patterns in a string with a dynamically generated content.
lets say i want to find all strings within ” in the string and double the string.
a string like:
my 'cat' is 'white' should become my 'catcat' is 'whitewhite'
all matches could also appear twice in the string.
thank you
Make use of the power of regular expressions. In this particular case:
\1refers to the first group in the regex (called$1in some other implementations).