Thursday, 22 August 2013

Match any string that starts with... (###)

Match any string that starts with... (###)

I'm new to regex and I'm trying to create an expression which matches any
string which begins with:
Open Parenthesis, 3 numerical digits, followed by a closing parenthesis:
Examples of what should fit:
(111)test
(212) hello
(321)
Should not work:
(a22)test
(anything with a decimal point or negative)
What I've created so far:

^(\d{3}^)* I've tried this on some online regex test sites but the
matching isn't working.
What did I miss?

No comments:

Post a Comment