Created
January 16, 2012 22:56
-
-
Save MilkZoft/1623471 to your computer and use it in GitHub Desktop.
code.jobs - Validate domain name - PHP, Regexp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $URL = "http://codejobs.biz/"; | |
| if(preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(?:.[A-Z0-9][A-Z0-9_-]*)+):?(d+)?/?/i', $URL)) { | |
| print "Valid URL"; | |
| } else { | |
| print "Invalid URL"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
la expresión regular propuesta no puede funcionar, creo que debería estar así:
por ser precisos, la descripción del gist debería de ser "validate url"
gracias por compartir :)