Posted By: Anonymous
I want to match two passwords with regular expression. For example I have two inputs “123456” and “1234567” then the result should be not match (false). And when I have entered “123456” and “123456” then the result should be match (true).
I couldn’t make the expression. How do I do it?
if you have a the input password in a variable and you want to match exactly 123456 then anchors will help you:
in perl the test for matching the password would be something like
print "MATCH_OK" if ($input_pass=~/^123456$/);
bart kiers is right tho, why don’t you use a strcmp() for this? every language has it in its own way
as a second thought, you may want to consider a safer authentication mechanism 🙂