O'Reilly logo

Extending MFC Applications with the .NET Framework by Nishant Sivakumar, Tom Archer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Replacing Matches Using Groups and Substitution Patterns

In the previous two sections, you've learned how to group and capture submatches and how to replace text. This section shows you how to combine those two capabilities with substitution patterns to give you an even more powerful means of manipulating text. Substitution patterns are just special characters that tell the Regular Expression engine how you want text replaced. Table 2-4 shows the available substitution characters that can be used.

Of special importance in Table 2-4 are the first two patterns, which allow us to specify groups in the capture and then use those group names in the replacement. Let's see how to do that with an example that converts between U.S. (mm/dd/yyyy) and European ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required