Problems? Is your data what you think it is? | |
PerlMonks |
Re: Regex to match 20 chars of some digits followed by some spacesby Chmrr (Vicar) |
on Dec 19, 2003 at 14:21 UTC ( [id://315798]=note: print w/replies, xml ) | Need Help?? |
Yet another way to do it: /^\d+ *(?<=^.{20})$/ That is, one or more digits, followed by zero or more spaces -- and only thereafter do we check that it summed to 20 characters total. Probably not as efficient (involves more backtracking) but easier for my eyes to understand.
In Section
Seekers of Perl Wisdom
|
|