in reply to Stumped by regex
Something like this? (It limits to strings no longer than twenty characters, nothing but letters and an optional space).
m/^(?=.{1,20}\Z)[a-z]+(?:\s[a-z]+)?$/i
In the end, however, I think you'd be better off using length to check the string's length outside the regex. Hope this is helpful.
They say that time changes things, but you actually have to change them yourself.
Andy Warhol
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Stumped by regex
by bsdz (Friar) on Dec 06, 2006 at 15:40 UTC | |
by JediWizard (Deacon) on Dec 06, 2006 at 15:58 UTC |
In Section
Seekers of Perl Wisdom