【php】正規表現 半角英大文字、小文字、数字を含む文字列を一度に判定
2024.04.04
<?php
$test = "aw2X";
if( preg_match( "/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$/", $test )) {
echo "ok\n";
}
else {
echo "ng\n";
}
<?php
$test = "aw2X";
if( preg_match( "/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$/", $test )) {
echo "ok\n";
}
else {
echo "ng\n";
}