#!/usr/bin/perl -w use strict; my $str = 'DPL1 DPLx RVLj ILKy VLKy Bartleby the ScriFVKner'; while ($str=~ /(DPL.|RVL.|[IV]LK.|FVK.)/g){ print "matched '$1' in string '$str'\n"; }