my $str = qq( "/extend 100" ); $str =~ m,"?(/.*)"?,; if (defined $1) { print "matched=$1\n"; } $perl regex.pl matched=/extend 100"