Article ID: 308252 - Last Review: July 21, 2008 - Revision: 7.0 How to match a pattern by using regular expressions and Visual C#
This article was previously published under Q308252
For a Visual Basic .NET version of this article, see 301264
(http://support.microsoft.com/kb/301264/
)
.
This article refers to the following Microsoft .NET Framework Class Library namespace:
On This PageSUMMARY This step-by-step article shows you how to create and use
regular expressions to determine whether strings match certain patterns.
Regular expressions allow for easy parsing and matching of strings to a
specific pattern. Using the objects available in the RegularExpressions namespace, you can compare a string against a given pattern,
replace a string pattern with another string, or retrieve only portions of a
formatted string. In this example, we will construct a pattern to validate a
e-mail address. RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
Using regular expressions to match a pattern
REFERENCES For more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
Regular Expression Syntax http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ab0766e1-7037-45ed-aa23-706f58358c0e.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ab0766e1-7037-45ed-aa23-706f58358c0e.asp?frame=true) Introduction to Regular Expressions (JScript .NET) http://msdn2.microsoft.com/en-us/library/28hw3sce(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/28hw3sce(vs.71).aspx) Introduction to Regular Expressions (Visual Basic Scripting Edition) http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx (http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx) Regular Expressions Language Elements (Microsoft .NET Framework General Reference) http://msdn.microsoft.com/en-us/library/az24scfc(VS.71).aspx (http://msdn.microsoft.com/en-us/library/az24scfc(VS.71).aspx) Regular Expression (RegExp) Object (Microsoft .NET Framework Class Library) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/05f9ee2e-982f-4727-839e-b1b8ed696d0a.asp (http://msdn.microsoft.com/en-us/library/az24scfc(VS.71).aspx) | Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|





















Back to the top