The following RegEx [0-9]*[ -/]{0,1}[0-9]*
matches e.g. 1*2
.
The * is not defined in my regex and not intended; the space before - needs not to be escaped (as far as I found out)
If I only use two character of [ -/]
, 1*2
do not match.
When I change the order e.g. to [0-9]*[-/ ]{0,1}[0-9]*
, 1*2
is not matching (like expected).
Do I miss something or is this a bug?
I have this behaviour with Java 7 and on http://www.regexplanet.com/advanced/java/index.html
Update The RegEx is used in the Bean Validation @Pattern(regexp = "[0-9][ -/]{0,1}[0-9]").