0
0

More than 1 year has passed since last update.

正規表現メモ

Posted at
  • 業務でちょっとした正規表現(半角英数字バリデーション)を書かないといけなかったので個人的メモです( preg_matchの中の一部抜粋 )
/^[a-zA-Z0-9]+$/

・先頭の「^」は文字列の初めからという意味
・[a-zA-Z0-9]に関しては> a~z、A~Z、0~9 の範囲
・「+」 は一回以上
・「$」 は文字列の最後まで

ちなみに「+」 のところは「*」にしてしまうと「0回以上」という意味になり空白文字を受けつけるので気をつけないとですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0