Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
G'day Bod, I agree with others that you should change the form. Ask specifically for first name and last name. "The obvious problem is that it fails with extended characters such as Zoë." Take a look at perlrecharclass and follow links from there. This code is not intended as a solution to your problem; it's just to demonstrate some options that are available: $ perl -Mstrict -Mwarnings -Mutf8 -C -E ' my $n = "Zoë Åcçéñt-Smythe"; my ($f, undef, $l) = $n =~ /([[:alpha:]]+)( +|\Z)([\p{Alpha}\p{Punct}]*)/; say $f; say $l; ' Zoë Åcçéñt-Smythe — Ken In reply to Re: Split first and last names
by kcott
|
|