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}/
2 つの問題:
{x,y}
preg_replace
preg_match
コードは次のようになります。
$input = "Frank"; $output = preg_replace("/^[a-zA-Z]{1,10}/", "stackoverflow", $input); print $output;