I need to check if entire given input matches given pattern.
But wrapping a pattern in ^/$ feels like a hack.
Is there a shortcut for:
var match = Regex.Match(myInput, "^" + myPattern + "$");
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no shortcut, and adding
^and$is not a hack. What you’re doing is exactly what you’re supposed to do in order to match an entire line.