4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

正規表現で使用する主なメタ文字(それ自体が何らかの固有の意味を持つ記号)をまとめます。

文字クラス

「-」はこの範囲に含まれる1文字、「^ - 」はこの範囲以外の1文字を表す。

構文 説明
[a-z] 小文字のアルファベット中の1文字
[^a-z] 小文字のアルファベット以外の1文字
[A-Z] 大文字のアルファベット中の1文字
[^A-Z] 大文字のアルファベット以外の1文字
[a-zA-Z] アルファベットの中の1文字
[^a-zA-Z] アルファベット以外の1文字
[0-9] 数字中の1文字
[^0-9] 数字以外の1文字

定義済み文字クラス

構文 説明
¥d 数字([0-9]と等価)
¥D 数字以外([^0-9]と等価)
¥s 空白文字
¥S 非空白文字
¥w 文字([a-zA-Z0-9_]と等価)
¥W 文字以外([^a-zA-Z0-9_]と等価)

その他

構文 説明
. 任意の1文字
^ 行の先頭
$ 行の末尾
¥b 単語境界
* 直前の文字の0個以上の並び
+ 直前の文字の1個以上の並び
? 直前の文字が0個、または1個
論理演算子のOR
4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?