Created
February 14, 2013 17:42
-
-
Save roberto-butti/4954572 to your computer and use it in GitHub Desktop.
Validazione stringa lunga da 1 a 250 caratteri, che comprende: lettere minuscole, maiuscole, numeri, spazi, punto e trattino
This file contains 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 | |
$username = "user-name12"; | |
$exp = "/^[a-zA-Z\d\ \.-]{1,250}$/i"; | |
if (preg_match($exp, $username)) { | |
echo "Your username is ok."; | |
} else { | |
echo "Wrong username format."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment