url-validation

Can't get why URL custom validation method for jQuery validation plugin not working

泄露秘密 提交于 2020-01-15 09:43:30
问题 I'm trying to validate URL. I want to make these URLs pass the validation: www.site.com www.super.co.uk I'm checking my RegEx in this site - http://www.rubular.com/ Here is my RegEx: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ It is working in Rubular site, but when I'm trying to use it in my custom jQuery validation Plugin method - it constantly tells me, that it is invalid: jQuery.validator.addMethod("complete_url", function(val, elem) { // if no url, don't do anything

django URLValidator produced bogus errors

风格不统一 提交于 2020-01-01 09:09:09
问题 I'm using the Django URLValidator in the following way in a form: def clean_url(self): validate = URLValidator(verify_exists=True) url = self.cleaned_data.get('url') try: logger.info(url) validate(url) except ValidationError, e: logger.info(e) raise forms.ValidationError("That website does not exist. Please try again.") return self.cleaned_data.get('url') It seems to work with some url's but for some valid ones, it fails. I was able to check with http://www.amazon.com/ it's failing (which is

How can I check if a URL exists with Django’s validators?

删除回忆录丶 提交于 2019-12-18 11:30:16
问题 I want to check in django if a URL exists and if it does I want to show something on screen, i.e.: if URL_THAT_POINTS_TO_SOME_PDF exists SHOW_SOMETHING 回答1: Edit: Please note, this is no longer valid for any version of Django above 1.5 I assume you want to check if the file actually exists, not if there is just an object (which is just a simple if statement) First, I will recommend always looking through Django's source code because you will find some great code that you could use :) I assume

is URL valid or not [duplicate]

北城余情 提交于 2019-12-18 03:56:36
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: what is the best way to check if a Url exists in PHP ?` I'm looking for a function that returns TRUE or FALSE in php, either the URL is valid or not. isValidURL($url); i think that simple... That would take into count all kind of URL possible. By valid i want It to referes to an existing page of the web or other kind of files. It just should exist 回答1: <?php $url = "http://stack*overflow.org"; if(filter_var($url

Facebook says valid URL is not a valid URL

妖精的绣舞 提交于 2019-12-13 15:18:14
问题 Trying to add the App Domain to a new app. Thing is the domain is http://the.me Facebook doesn't consider this to be a valid URL. Any workaround? 回答1: Are you including http:// in there? It shouldn't have that. Just use the.me as your domain. I just tried it and it worked for me. See example: http://imgur.com/g8sjE 回答2: have you tried using http://www.the.me adding the www might work with FB 来源: https://stackoverflow.com/questions/9612325/facebook-says-valid-url-is-not-a-valid-url

Validate url in PHP & Jquery?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:15:48
问题 I want to validate following kind of url's in jquery and in PHP at both client and server side validation. http://en.wikipedia.org/wiki/Great_Wall_of_China (without www) www.wikipedia.org/ (without http, later when we validate this at PHP then we'll check if http:// is not there then we'll add it) I have created regex to validate url in jquery ^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.) But its not validating URL http://en.wikipedia.org/wiki/Great_Wall_of_China and

javascript Regex for Absolute AND relative URl

て烟熏妆下的殇ゞ 提交于 2019-12-11 01:37:54
问题 Is there any regex which will validate both an absolute URL and relateve URl for Javascript. I do have following Regex which works fairly well for absolute URL except the part where it is making the HTTP part mandatory. I want it optional. Here is Regex: /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/; thanks 回答1: quick answer, modified Arun's answer to accept '/page', '/page/subpage', 'page/subpage' /(\/?[\w-]+)(\/[\w-]+)*\/?|(((http|ftp|https):\/\/)?[\w-]+(\.

django URLValidator produced bogus errors

对着背影说爱祢 提交于 2019-12-04 02:39:43
I'm using the Django URLValidator in the following way in a form: def clean_url(self): validate = URLValidator(verify_exists=True) url = self.cleaned_data.get('url') try: logger.info(url) validate(url) except ValidationError, e: logger.info(e) raise forms.ValidationError("That website does not exist. Please try again.") return self.cleaned_data.get('url') It seems to work with some url's but for some valid ones, it fails. I was able to check with http://www.amazon.com/ it's failing (which is obviously incorrect). It passes with http://www.cisco.com/ . Is there any reason for the bogus errors?

Validating URLs in Python

自古美人都是妖i 提交于 2019-12-03 11:45:25
问题 I've been trying to figure out what the best way to validate a URL is (specifically in Python) but haven't really been able to find an answer. It seems like there isn't one known way to validate a URL, and it depends on what URLs you think you may need to validate. As well, I found it difficult to find an easy to read standard for URL structure. I did find the RFCs 3986 and 3987, but they contain much more than just how it is structured. Am I missing something, or is there no one standard way