Regular Expressions Sample

To get samples and instructions for installing them, see the following:

  • Click Samples on the Visual Studio Help menu.

    For more information, see Locating Sample Files.

  • The most recent versions and the complete list of samples are available on the Visual Studio 2008 Samples Web site.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied to a folder under \Program Files\Visual Studio 9\Samples\. For Visual Studio Express Editions, all samples are located on the Internet.

To run this sample

  • Press F5.

Requirements

A connection to the Internet is required for the screen-scraping feature of the sample.

Demonstrates

This sample application shows how to use regular expressions.The tab pages demonstrate:

  • Basic parsing techniques   This tab page uses the Regex class to find numbers in a string, and valid zip codes, email addresses, and dates.

  • Screen-scraping   This tab shows a more advanced use of regular expressions. You can enter a Web address and view the links or images contained in it. HTML tag attributes are displayed in a ListView control. You can double-click an image to view it, or double-click a link to open Internet Explorer and view the page.

  • Testing   This tab provides a convenient way to experiment with regular expressions. It also demonstrates how to do search and replace and string splitting.