use strict;
my $str = 'JINA L. CHOI (NY Bar No. 2699718)
ERIN E. SCHNEIDER (Cal. Bar No. 216114) schneidere@sec.gov
MONIQUE C. WINKLER (Cal. Bar No. 213031) winklerm@sec.gov
JASON M. HABERMEYER (Cal. Bar No. 226607) habermeyerj@sec.gov
MARC D. KATZ (Cal. Bar No. 189534) katzma@sec.gov
JESSICA W. CHAN (Cal. Bar No. 247669) chanjes@sec.gov
RAHUL KOLHATKAR (Cal. Bar No. 261781) kolhatkarr@sec.gov
The Investor Solicitation Process Generally Included a Face-to-Face Meeting, a Technology Demonstration, and a Binder of Materials [...]
TSPU or taken
TSPU or the
TSPU only
TSPU was
TSPU and';
my $regex = qr/\b(?!TSPU\b)[A-Z]{4,}(?:(?:\s+\w\.)?\s+\w+)?/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html