Currently, I am doing search and replace using this pattern:
"(?<=\\{).+?(?=\\})". This finds everything inside curly brackets. (Courtesy of https://stackoverflow.com/a/8526268/1143917)
I use ‘MatchEvaluator’ with a delegate, so, when the input string is {this} is a {string}, the delegate receives this and string.
This is not good for me because I want to replace both the matches and the curly brackets.
How do I change my regex expression so the delegate will receive matches with the curly brackets included, i.e. {this} and {string}?
Remove the positve lookbehind and positive lookahead, and just use the brackets:
I can’t be sure about this because I’ve never used regular expressions with C++, but the principle is match
{, plus all characters that are not}, plus}.