Regular expression for validating website
i bet this can be tweaked a little more but it does the job pretty nice for being so short and compact... .\w\S* or find anything that must have a text then a dot then at least 2 letters and then a ? a=5 (and all its permutations) m.google.com/help.php? a=5 (and all its permutations) The important thing for any urls that dont start with http or www is that they must include a / or ? ]\S* I've been working on an in-depth article discussing URI validation using regular expressions. Regular Expression URI Validation Although the article is not yet complete, I have come up with a PHP function which does a pretty good job of validating HTTP and FTP URLs. If you need to check if it's actually valid, you'll eventually have to try to access whatever's on the other end. If you want to check if a URL is well-formed, it should be sufficient for your needs. # top level domain OR )|((\d|[1-9]\d|1\d|2[0-4][0-9]|25[0-5])\.)(? # path and query string optional )(#([a-z0-9$_\.\ ! $_iu S The post Getting parts of a URL (Regex) discusses parsing a URL to identify its various components.
:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x\x-\x! :[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9] )*(? In general, though, you'd probably be better off using a function that's supplied to you by your framework or another library. For example, there's Python's urlparse module, and in . Uri class's constructor as a means of validating the URL. The side bar includes a Cheatsheet, full Reference, and Help. Explain describes your expression in plain English.
Search for regular expression for validating website:
Web Site Not like 'what is the expression for URL ??