- Sep 29, 2004
- 18,656
- 67
- 91
Well, I'm working with Java's built in regular expression classes.
I need to look for expressions that take the form:
1 - 1/2
12 - 1/4
123 - 1/8
etc
I have the following regular expression:
^[0-9]+\s*-\s*(([0-7]/8)|([0-3]/4))|([0-1]/2)$
Why does the following show up as a pattern match:
-12 - 1/2
12 - 1/2 should show up. But the negative symbol that leads in should casue the string to not come up as a match. What is going on here? Is this a Java bug???
Thanks....
I need to look for expressions that take the form:
1 - 1/2
12 - 1/4
123 - 1/8
etc
I have the following regular expression:
^[0-9]+\s*-\s*(([0-7]/8)|([0-3]/4))|([0-1]/2)$
Why does the following show up as a pattern match:
-12 - 1/2
12 - 1/2 should show up. But the negative symbol that leads in should casue the string to not come up as a match. What is going on here? Is this a Java bug???
Thanks....