|Think about Loose Coupling|
Should be a simple spaces/digits regex....but I'm turning grey!by viffer (Beadle)
|on Aug 05, 2014 at 01:50 UTC||Need Help??|
viffer has asked for the wisdom of the Perl Monks concerning the following question:
I'm hoping someone can point out the error of my ways... I'm sure there is a simple regex for this but I'm buggered if I can figure it out.
I am trying to match a field that may have a number of leading spaces, followed by a number of digits, but can't have any spaces after a digit has been found. It must contain at least one digit at the end,
but can't be
' 99 9'.
I have a regex which works
but when you're checking a 16 byte filed
a regex of
whilst doing the job,is getting ludicrously large and unreadable
There must be a shorter regex that covers this?
Someone at work suggested using an sprintf in it's stead within the regex, but I must be honest and say that suggestion has left me clueless on how to do it.
Thanks for your time