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.
電話番号を一致させる必要があります:
010 または 012 または 016 または 019 で始まる
正確に10個の数字で構成されています
PHP と正規表現を使用して数字を一致させる方法を教えてください。
return preg_match('/^01[0269]\\d{7}$/', $theStringToTest);
これは、0、1、(0、2、6、9) の 1 つ、および任意の 7 つの数字 (3+7==10) に一致します。は文字列の^開始を意味し、文字$列の終了を意味します。
^
$
私は使うと思う^01[0269][0-9]{7}$
^01[0269][0-9]{7}$