on-internet
← Community

Regex to match with a string with a '+' character

Stack Overflow ·

my $line = "[email protected]_64"; my $regex = "[email protected]_64"; if ($line =~ m/^$regex$/) { print "matched\n"; } else { print "not matched\n"; } Even though $line and $regex are the same string, regex is not matched. If I remove + from both of the strings, they match. How do I get those two strings to match with + in them?

Comments

Sign in or sign up to comment and upvote.

No comments yet.