in reply to RegExp, grabbing first name
The match /([A-Z]{3,})/g works for me by extracting both the surname and the forename. Example:
#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 2; my %names = ( 'BULLOCK JOE A' => 'JOE', 'SMITH, A DOE' => 'DOE' ); for my $fullname (keys %names) { my ($sname, $fname) = $fullname =~ /([A-Z]{3,})/g; is ($fname, $names{$fullname}, "Forename $fname extracted from $fu +llname"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RegExp, grabbing first name
by Anonymous Monk on Feb 25, 2016 at 19:23 UTC | |
by poj (Abbot) on Feb 25, 2016 at 19:46 UTC | |
by hippo (Archbishop) on Feb 25, 2016 at 23:50 UTC | |
by ExReg (Priest) on Feb 25, 2016 at 20:07 UTC |