my $String="1234A4321"; my $RegEx=qr/a/i; $String =~ $RegEx; print "Match: ",$&||"none"," Pre: ",$`||"none"," Post: ",$'||"none","\n"; # Match: A Pre: 1234 Post: 4321