I have a regex that matches (8/10)
or (9/10)
or (10/10)
which is good but it also matches (0/10)
.
I want the regex to only match (8/10)
or (9/10)
or (10/10)
. Can someone please take a look at my regex and provide guidance?
([8-9,10]./*.*)
Answer
You could use an alternation to match either 8, 9 or 10 followed by /
and 10
The character class [8-9,10]
matches any of the listed chars, and as you escaped the -
it could also match that.
((?:[89]|10)/10)