I have to validate and match numbers in a string. Acceptable formats: 
11, 
-11, 
+11, 
(11), 
(+11), 
(-11).
Half parenthesis are not acceptable.
I have created a regex which will match
11, 
-11, 
+11: 
[\-\+]?\d++ 
This works well. I have created a pattern to apply to the parenthesis version too. This String is a base input for the string format method: ^(\(%1$s\))|(%1$s)$ where the simple parenthesis are for the the group capture and the escaped are for the match.
The result is: 
^(\([\-\+]?\d++\))|([\-\+]?\d++)$  
This match for the above strings also match the (+11. Which is not acceptable. Also if the filter with parenthesis is the second condition than it match to the +11).
Any idea how to improve this?
UPDATE:
I can't delete this post, but it's wrong. I made that mistake to use the find method instead of match. My regex is good and working.
 
     
     
     
    