Visual Studio .Net is an integrated development environment (IDE) from Microsoft which has been designed to support .Net Framework. The .Net Framework is a base class library (BCL) which includes common functions such as file reading and writing, database interaction, XML document manipulation, graphic rendering and etc. One of useful method that allows to find a match in input string is Regex.IsMatch, which return true if the regular expression finds a match, otherwise return false.



Regex.IsMatch method is useful especially for those developers who want to validate or ensure the users input are match to particular pattern. As example, the developer might want to validate the telephone number that is matched to their predefined format such as 480-798807. In this case the regular expression pattern is ^[0-9]{3}-[0-9]{6}$ with two sets of characters separated by hyphens. The first set, which contains three numeric characters, while second set contains six numeric characters.

Note: ^ indicate “Begin” the match at the beginning of the line and $ indicate “End” the match at the end of the line.

How to use Regex.IsMatch method in Visual Studio C#:

How to use Regex.IsMatch method in Visual Basic:

More sample of Regex.IsMatch method can be accessible at .

Related Posts