use warnings; use strict; my $string = q {...blah... SyncBookmarkRecordType12345·bjbjUU...blah}; my $foo = qr { (.+)(?=)}; if ($string =~ m#$foo#) { print "\nMatched \"fiop\" label: |$1|\nMatched Length: |$2|\nMatched data: |$3|\n"; } else { print "no match \n"; } print "\nDone \n\n";