Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试匹配某个字符串,该字符串将是一个名称
preg_match("/^[a-zA-Z]{1, 10}/", "stackoverflow");
但这给了我一个错误,如果字符串大于值 a 且小于值 b,我将如何匹配?
太多的空格。
/^[a-zA-Z]{1,10}/
两个问题:
{x,y}
preg_replace
preg_match
您的代码应该是:
$input = "Frank"; $output = preg_replace("/^[a-zA-Z]{1,10}/", "stackoverflow", $input); print $output;