Quote:
Originally Posted by myce
The blank or dash before the number isn't relevant. The regexp will (should) start matching at the first digit.
|
No it should start at the first Matching
pattern:
The pattern should attempt to match starting at the first digit.
\d+\-\d+\-\d+\-(\d|X)
is one pattern, the first digit pair followed by a space should not be included in the match because it violates this pattern (dash separator)
Now if they had used spaces every place, you are correct, that the pattern should have started with the 10 (because we don't know where the line ends, we can')t tell that there were more digits than the pattern could capture if it had not started with the
wrong number group
Because of all the various ways of printing the ISBN, lots of post capture validating needs to be done (The FAX number managed to MOD11 validate

(a fairly rare case) ).