I want my Regex to match all valid URLs that do not end with
.gif
.jpg
.jpeg
.doc
I tried
http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=;]*)?((?!jpg)|(?!gif)|(?!doc))
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 need to use a lookbehind for that, try
You need also the anchor
$at the end, it matches the end of the string, that is important to define clearly the point from where the lookbehind should look behind.See it here on Regexr