in reply to RegExp, grabbing first name
This matches the two test strings you provided and captures the firstname:
/^[^, ]+(?:,\s+\w+|)\s+(\w+)/
Here's my test:
$ perl -wnE '/^[^, ]+(?:,\s+\w+|)\s+(\w+)/; say $1;' SMITH, A DOE DOE BULLOCK JOE A JOE
— Ken
|
---|