Regex is also known as a regular expression in c#. The regular expression is used to provide a pattern which is further used to identify whether the given string or string which we input from the user matches the pattern or not. Regex is a class provided by c#; it does two things,
string[] str = {"9925612824", "8238783138", "02812451830"};
string strRegex = @"(^[0-9]{10}$)|(^\+[0-9]{2}\s+[0-9]
{2}[0-9]{8}$)|(^[0-9]{3}-[0-9]{4}-[0-9]{4}$)";
Here in the above example, an array of numbers are given, and the regular expression pattern is also given, which will try to find if the numbers match with the pattern. There are some methods in regular expressions which are used to check whether the pattern is matching or not.
|
|