Created
April 14, 2015 15:01
-
-
Save fernandosavio/c441cf78bbf056b65cf2 to your computer and use it in GitHub Desktop.
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 | |
function teste_unicode_regex($value) { | |
$min = (preg_match("/\\p{Ll}/u", $value)) ? "Sim" : "Não" ; | |
$mai = (preg_match("/\\p{Lu}/u", $value)) ? "Sim" : "Não" ; | |
$num = (preg_match("/\\d/", $value)) ? "Sim" : "Não" ; | |
echo <<<TEXT | |
=== $value === | |
Caracteres minúsculos: $min | |
Caracteres maiúsculos: $mai | |
Caracteres numéricos : $num | |
=========== | |
TEXT; | |
} | |
teste_unicode_regex("aaa"); | |
teste_unicode_regex("äää"); | |
teste_unicode_regex("ÄÄÄ"); | |
/* | |
=== aaa === | |
Caracteres minúsculos: Sim | |
Caracteres maiúsculos: Não | |
Caracteres numéricos : Não | |
=========== | |
=== äää === | |
Caracteres minúsculos: Sim | |
Caracteres maiúsculos: Não | |
Caracteres numéricos : Não | |
=========== | |
=== ÄÄÄ === | |
Caracteres minúsculos: Não | |
Caracteres maiúsculos: Sim | |
Caracteres numéricos : Não | |
=========== | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment