0
0

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 1 year has passed since last update.

正規表現まとめ

Posted at

正規表現とは

正規表現とは、文字列の規則を表したパターンのこと。

メタ文字と正規表現

正規表現は、「A」「a」「1」「あ」のような通常の文字と、メタ文字と呼ばれる特殊な意味を持つ記号の組み合わせで文字列のパターンを表現する。

・正規表現で用いられる主なメタ文字

メタ文字 意味
. 任意の1文字
^ 〜ではじまる([]内で使用すると除外を意味する)
$ 〜で終わる
- 文字の範囲指定
* 直前の文字を0回以上繰り返す
+ 直前の文字を1回以上繰り返す
? 直前の文字がない、またはある
( グループ化の開始
) グループ化の終了
{ 繰り返す回数の指定の開始
} 繰り返す回数の指定の終了
[ パターン定義の開始
] パターン定義の終了
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?