Javascript RX URL
-
Hello everyone! Does anybody has a full RegEx in Javascript to test http urls? Tnx! Mariano, el estupefacto. :wtf:
//TODO: Make this damn code work!
http://www.regexlib.com/[^] How do I print my voice mail?
-
Hello everyone! Does anybody has a full RegEx in Javascript to test http urls? Tnx! Mariano, el estupefacto. :wtf:
//TODO: Make this damn code work!
Try this fairly crude pattern match...
(\s|\n|^)(\w+://[^\s\n]+)
For future reference, visit www.regexlib.com[^] to see if someone has already done the leg-work. You can also test them @ http://www.regexlib.com/RETester.aspx[^] Hope this helps, Andy
-
Try this fairly crude pattern match...
(\s|\n|^)(\w+://[^\s\n]+)
For future reference, visit www.regexlib.com[^] to see if someone has already done the leg-work. You can also test them @ http://www.regexlib.com/RETester.aspx[^] Hope this helps, Andy
Yes, thanks, I know the page, it has great RegExs, but I was looking foward for something more 'Standard', like from w3.org, or IEEE, or so. Because that expression isn't at all accurate for the use I want to give to it. For example: http://HelloMyNameIsMariano matches with it. I'm looking for expression for Internet URL Addresses. Thanks anyway. What I'm doing now is a System.Net.WebRequest, that way I can be sure the address is good and exists! Bye!!! Mariano, el estupefacto. :wtf:
//TODO: Make this damn code work!
-
Yes, thanks, I know the page, it has great RegExs, but I was looking foward for something more 'Standard', like from w3.org, or IEEE, or so. Because that expression isn't at all accurate for the use I want to give to it. For example: http://HelloMyNameIsMariano matches with it. I'm looking for expression for Internet URL Addresses. Thanks anyway. What I'm doing now is a System.Net.WebRequest, that way I can be sure the address is good and exists! Bye!!! Mariano, el estupefacto. :wtf:
//TODO: Make this damn code work!
-
|/| / |Z ! / || [] wrote: good and exists A regex may tell you if its syntactically good, but it wont tell you that it exists :confused:
What I meant is that you can evaluate "http://www.thisaddressdoesnotexists.com" and it will work fine. But with the WebRequest you'll have an URINotFoundException. See what I'm saying? Regex wont test if it exists on the web, but WebRequest will. That's what I tried to say. Mariano, el estupefacto. :wtf:
//TODO: Make this damn code work!