Regex started by space and followed by numbers -
i'm trying evaluate string through regex following rules: string has 5 characters, being first n whitespaces , last 5-n (at least 1) numbers.
(\s*\d{1,5})
works, matches " 12345"
, outside of rules.
any idea?
try this:
^(?=.{5}$)\s*\d+$
the character limit handled using ahead. rest straightforward.
see live demo
Comments
Post a Comment