PHP preg_match - 仅允许字母数字字符串和 - _ 字符
2022-08-30 13:27:55
我需要正则表达式来检查字符串是否仅包含数字,字母,连字符或下划线
$string1 = "This is a string*";
$string2 = "this_is-a-string";
if(preg_match('******', $string1){
echo "String 1 not acceptable acceptable";
// String2 acceptable
}