Skip to main content
Visual C++ Samples 
RegExp Sample: Demonstrates ATL Regular Expression Classes 

Download sample

Demonstrates how to use CAtlRegExp and CAtlREMatchContext to search and replace regular expressions inside a file uploaded to a Web server.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.


  • IIS

Building and Running the Sample

To build and run this sample

  1. Open the solution file, rxReplacer.sln, in the Visual Studio development environment.

  2. Build the solution. This will also deploy the solution to the local Web server.

  3. Use a Web browser to view http://localhost/rxreplacer/rxreplacer.srf.

  4. Use the Browse button to choose the file in which you want to find/replace a regular expression.

  5. Type in the regular expression and the new expression you want to substitute it with.

  6. Use the check boxes to set options for your search, including case sensitivity, global substitution, and use of variables.

  7. Click Get Modified File to obtain the new file.


See Also