use strict;
my $str = 'Ya_UH and_CC then_RT uhm_NN1 we_PPIS2 wrote_VVD in_RP but_CCB already_RR taken_VVN up_RP that_DD1 day_NNT1 that_CST we_PPIS2 wanted_VVD actually_RR they_PPHS2 said_VVD still_RR available_JJ you_PPY know_VV0 so_RR by_II that_DD1 time_NNT1 we_PPIS2 we_PPIS2 write_VV0 in_II our_APPGE letter_NN1 two_MC weeks_NNT2 later_RRR already_RR taken_VVN up_RP Quite_RG good_RR uh_UH P ICE-SIN:S1A-001#74:1:B Ask_VV0 her_PPHO1 I_PPIS1 left_VVD my_APPGE house_NN1 at_II one_MC1 met_VVD PRO_NN1 in_II school_NN1 at_II two_MC Ya_PPY so_RR waited_VVD you_PPY know_VV0 they_PPHS2 say_VV0 half_DB hour_NNT1 later_RRR And_CC and_CC it_PPH1 was_VBDZ still_RR drizzling_JJ and_CC raining_VVG';
my $regex = qr/_P(?:N(?:X?1|Q[OSV]|)|P(?:GE|H1|(?:[HI]O|IS|X)[12]|HS2|Y))\s\w+_V[A-Z0-9]*\b(*SKIP)(*F)|\w+_V[A-Z0-9]*\b/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