in reply to matching between 1 to 8 digits but not more
A good way to re-formulate the question is: does the string contain 1 to 8 digits that are neither followed nor preceded by digits?
When you ask it like that, it's easy to formulate as a regex:
m/(?<! \d ) \d{1,8} (?! \d )/x
For an explanation of the look-ahead and look-behind groups see perlre.
|
|---|