Well, you have a lot of replies, and I think they all fail your spec. ... well done :).
This is probably what I would do...
sub surname { # Assumes ASCII locale $_ = shift; return undef if (length($_) > 20); return $_ if /^([a-zA-Z]+)$/; # Surname is only one return $_ if /^[a-zA-Z]+ ([a-zA-Z]+)$/; # Surname only return undef; }
In reply to Re: Stumped by regex
by nevyn
in thread Stumped by regex
by brickwall
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |