I’m trying to set a regexp which will check the start of a string, and if it contains either http:// or https:// it should match it.
How can I do that? I’m trying the following which isn’t working:
^[(http)(https)]://
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.
Your use of
[]is incorrect — note that[]denotes a character class and will therefore only ever match one character. The expression[(http)(https)]translates to “match a(, anh, at, at, ap, a), or ans.” (Duplicate characters are ignored.)Try this:
If you really want to use alternation, use this syntax instead: