I compiled it in PHP, but it can be used in other languages. It's discouraged (for obvious reasons) but perfectly valid and should be anticipated. ) browsers sometimes translate HTTP authentication into the URL for subsequent [email protected], in a function in what language? If you suspect the entirety of a string is a URL, then I'd 100% agree with you and mention that Java's equivalent is var urlreg=/(([\w] :)? $_iu S Regexes are, however, beautiful for extracting URLs from a body of plaintext. "h:" is valid prefix See w3.org/Addressing/URL/for details.
How can I check if a given string is a valid URL address? Surely a good start: msdn.microsoft.com/en-us/library/ff650303NB. The above page is retired, but the expressions in the table are essentially still valid for reference.
My knowledge of regular expressions is basic and doesn't allow me to choose from the hundreds of regular expressions I've already seen on the web. The URL expression recommended (and which worked great for me) is: "^(ht|f)tp(s?
If a URL has no leading "http(etc)", how would you be able to distinguish it from any other arbitrary string that happens to have dots in it? )\:\/\/[0-9a-z A-Z]([-.\w]*[0-9a-z A-Z])*(:(0-9)*)*(\/?
Alternately, it would be pretty simple for you to do the same in a language of your choosing.. Scheme to confirm the http/https/ftp protocol is being used, otherwise if such a URL is inserted into your ASP.
Should I write a function in all of those languages?
)$/i Edit 7 March 2011: Because of the way PHP handles backslashes in quoted strings, these are unusable by default. # top level domain OR )|((\d|[1-9]\d|1\d|2[0-4][0-9]|25[0-5])\.)(?