How to make sure I don't allow more than one brackets "(" and ")" in the input text? I have the following expression that will allow numbers, spaces, hyphens and brackets.
Regex.Match(text, @"^[0-9 (,),-]+$").Success
I don't what to allow something like "((123) 456-7891 or (91)123-23123(1). The correct string can be: "(123) 1231231 or (121)123-213123.
Edited: Sorry for not being clear. Requirement is to only allow numbers, spaces, hyphens and brackets (one set only). To be specific, "(" should always have a closing bracket ")". As one of you said no paren or one set of paren. If someone can also tell how to allow the paren at any position not only at the start?