in reply to Extract pattern from string
G'day madbee,
"So, given a string:"Study Protocol (No.|No|Number) NBXF317N2201", how can I modify my expression in order to extract NBXF317N2201 which is always a combination of alpha-and numbers and is always 12 characters long?"
If that's really all you need to do, just anchor your regex to the end of the string:
$ perl -Mstrict -Mwarnings -E ' my $str = "Study Protocol (No.|No|Number) NBXF317N2201"; my ($term) = $str =~ /([A-Z0-9]{12})$/; say $term; ' NBXF317N2201
-- Ken
|
|---|