My skills at interpreting regular expressions are a bit rusty. Can someone help me with this one?
^[V0-9]?\d{2}(\.\d{1,2})?
I know the first expressions says that the start of the string begins with the character V or a digit. But then I have trouble interpreting the rest. What does the first “?” mean? I know \d{2} means a two character digit string. But what does it mean in the context of the preceding “?”. Then is the expression in the parentheses meaning that optionally there is a two digit character string preceded by a “.”?
String starts with an optional single character that’s either V or a digit (that is, the first
?pertains to the[V0-9]).… followed by exactly two digits
… followed by an optional sequence/subpattern consisting of
… a single period (
.) followed by either 1 or 2 digits.That means, yes, your interpretation
is correct (almost).