use strict;
my $str = '/maple-lodge-luxury-bed-and-breakfast/hotel/wanaka-nz.html?asq=1rrVgHWD%2ftbMPIK6tfFoOBewg1Z5%2buLS%2bSEDbaA%2fbS1Cje5wmB0pR0%2bLKktHrg4HC2IQVGwjWisHJHwdUYn88XKp1eogKj%2fzaqwNenpp8R5J8sYcWQ4ELgyWRz8zKFhqCpAzJy%2bIPcIhZIlXClDyysYo7iqvOXmWbg%2fTJAqzGDB7np8MbTsvr9hmeUc%2bP9lIlRlyZyrcrq%2fMBp7AbaEJbA%3d%3d&hotel=99830&tick=637329177909';
my $regex = qr/.*(\?)/p;
if ( $str =~ /$regex/ ) {
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