Regex for French telephone numbers

You can use: ^ (?:(?:\+|00)33|0) # Dialing code \s*[1-9] # First number (from 1 to 9) (?:[\s.-]*\d{2}){4} # End of the phone number $ See demo It allows whitespaces or . or – as a separator, or no separator at all

Regular expressions C# – is it possible to extract matches while matching?

You can use regex groups to accomplish that. For example, this regex: (\d\d\d)-(\d\d\d\d\d\d\d) Let’s match a telephone number with this regex: var regex = new Regex(@”(\d\d\d)-(\d\d\d\d\d\d\d)”); var match = regex.Match(“123-4567890”); if (match.Success) …. If it matches, you will find the first three digits in: match.Groups[1].Value And the second 7 digits in: match.Groups[2].Value P.S. In C#, … Read more

Keep only numeric value from a string?

You do any of the following: Use regular expressions. You can use a regular expression with either A negative character class that defines the characters that are what you don’t want (those characters other than decimal digits): private static readonly Regex rxNonDigits = new Regex( @”[^\d]+”); In which case, you can do take either of … Read more