$ perl -dE 42 Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 42 DB<1> $regex = qr/abc.*f/; DB<2> $new = "abcd.*f"; DB<3> $new =~ s/.\*//g; DB<4> $new =~s/(.)\+/$1/g; DB<5> p $new; abcdf DB<6> print "true" if $new =~ /$regex/; true DB<7>