#!/usr/bin/env perl use 5.010; use warnings; use strict; my @frags = qw{ "'frags'" "'frags frags'. frag's. frags. frags' }; for my $frag (@frags) { print "{$frag} : "; if ($frag =~ /\W'\w/) { #1 print 'matched by first regex. '; } if ($frag =~ /\w'\W/) { #2 print 'matched by second regex. '; } if ($frag =~ /\W'\w | \w'\W/) { #3 print 'matched by third regex. '; } say ''; }