i want regex that only accept number format with closing and opening round brackets format like this(091)(022)(2)(123-4567)
This i want to use in C#.
i want regex that only accept number format with closing and opening round brackets format like this(091)(022)(2)(123-4567)
This i want to use in C#.
The regular expression I would use is this:
^(\([0-9-]+\))+$
This expression will match all of it, or nothing.
To test a string against the expression in C#, it would look something like this:
var str = "(091)(022)(2)(123-4567)";
var isMatch = Regex.IsMatch(str, @"^(\([0-9-]+\))+$");