Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Developer's Guide
Regular Expression Examples

Updated: November 2007

This section contains code examples that illustrate the use of regular expressions in common applications.

Note:

The System.Web.RegularExpressions namespace contains a number of regular expression objects that implement predefined regular expression patterns for parsing strings from HTML, XML, and ASP.NET documents. For example, the TagRegex class identifies start tags in a string and the CommentRegex class identifies ASP.NET comments in a string.

Example: Scanning for HREFS

Provides an example that searches an input string and prints out all the href="…" values and their locations in the string.

Example: Changing Date Formats

Provides an example that replaces dates in the form mm/dd/yy with dates in the form dd-mm-yy.

How to: Extract a Protocol and Port Number from a URL

Provides an example that extracts a protocol and port number from a string that contains a URL. For example, "http://www.contoso.com:8080/letters/readme.html" returns "http:8080".

How to: Strip Invalid Characters from a String

Provides an example that strips invalid non-alphanumeric characters from a string.

How to: Verify that a String is in Valid E-Mail Format

Provides an example that you can use to verify that a string is in valid e-mail format.

System.Text.RegularExpressions

Provides class library reference information for the .NET Framework System.Text.RegularExpressions namespace.

Regular Expressions as a Language

Provides an overview of the programming language aspect of regular expressions.

Regular Expression Classes

Describes the regular expression classes contained in the System.Text.RegularExpression namespace and provides examples of their use.

Details of Regular Expression Behavior

Provides information about the capabilities and behavior of .NET Framework regular expressions.

Regular Expression Language Elements

Provides information on the set of characters, operators, and constructs that you can use to define regular expressions.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker