Let’s face it, regular expressions are powerful and can be an immense pain in the butt to write. While crafting a regular expression to perform any input recognition is possible, it becomes exceedingly difficult when the matching rules require more complicated logic. In specific scenarios, doing an initial regular expression match is more straightforward, and then applying code logic to get the desired result.
This post will look at a straightforward example of using
RegEx.Replace with the
MatchEvaluator to do a two-step replacement of matched tokens.