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.
私は電話番号を識別するためにこの式を試しました:
^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$
ただし、この検証はLinux上のCでは機能しません。
これが機能するかどうかを確認します。REG_EXTENDED拡張正規表現 (フラグ)を使用していると仮定します。
REG_EXTENDED
"^(?\\([0-9]{3}\\))?[-. ]?\\([0-9]{3}\\)[-. ]?\\([0-9]{4}\\)$"
ERE は、をリテラルとして扱い(、をグループ化として扱うという点で少し異なります。)()\(\)
(
)
\(
\)
参考文献: