Given a user input string, I need to find if it end with one of the following – .com, .net , .edu., html etc.
Is there any way to do this with the regex square brackets?
I tried $[.com|.net|.html] and $[(.com)(.net)(.html)] but both don’t work.
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.
You want to use a capture group.
This will match either one of the values. You can add additional values by appending another pipe inside the parenthesis and placing the new value after the pipe.