I tried to write a regular expression to work with the position-absolute jQuery validation plugin to give error if the string is left empty OR its a invalid URL. It works well for the URl but doesn't give error if a empty string is there . Here's the regex When tested against the empty string, the regex returns false. -- Asad Nov 13 at 9:43 But sadly it doesn't work with the validation plugin :( and the validation doesn't show popup error. -- user1808304 Nov 13 at 9:44 3 Perhaps you need to make the field required. I assume the plugin does not use the regex on empty fields. -- Asad Nov 13 at 9:45 Actually that's the main problem, we want the required validation in the regex only, so even if the field is left blank, it gives an error - Invalid URL, and not 2 errors like Field required and Invalid URL -- user1808304 Nov 13 at 9:50 You can set the error message to be the same one (Invalid URL), for both missing values and invalid values. -- Asad Nov 13 at 9:51 I'm using a different plugin for URL Validation, and for all other errors on the site this plugin works. It only messes up for the URL field. Can't change the validation method as we will have to change a lot of things. Better to get this one thing fixed :) - Thanks -- user1808304 Nov 13 at 9:54 The problem is with the regex