Write For Us

Test .Net Regular Expressions

.Net Regular Expression Syntax Summary | Add to Favorites

Choose Extract Data, Search-and-Replace, Data Validation or Split String option to test your regular expressions in four common scenarios in ASP.NET or other application that uses .Net RegEx engine. All RegexOptions can be turned on and off to fully adopt to your specific case.

Extract Data

Very common use of regular expressions is to extract wanted data from text. This test application uses Regex.Matches method to return result as string array.

Search And Replace

Search and replace scenario uses two regular expressions: first expression search for data (like in previous Extract Data tester) and additional second expression defines replacement. Tester application uses Regex.Replace method to transform given text.

Data Validation

To check if string is formatted in certain way use Data Validation tester. Except Regex class which is universal solution, ASP.NET provides RegularExpressionValidator control that can be used to validate user input on web forms. More about both methods you can read at Data Validation With Regular Expressions In ASP.NET tutorial.

Split String

In split string case unlike other methods, regular expression is used to define what is NOT returned by Regex engine. When using Regex.Split method regular expression defines only divider, while result is array of strings that regular expression didn't match.