About This Tool

What is 正規表現テスター?

A tool for testing regular expressions with real-time matching against test strings. Used for debugging and developing regex patterns for string searching, validation, and text parsing in development workflows.

How to Use

  1. Enter your regex pattern in the top input field.
  2. Enter the test string in the area below.
  3. Matching portions are highlighted in real-time.
  4. Configure flags (case insensitive, multiline, etc.) to adjust matching behavior.

Key Features

  • Real-time regex matching with highlighting
  • Case insensitive, multiline, and dotAll flags
  • Detailed match text, position, and capture group display
  • ECMAScript, RE2, and PCRE2 engine selection

Tips

  • For email validation, use standardized regex patterns rather than simple ones.
  • Capture groups () allow you to extract specific matched portions.
  • Using the ? quantifier performs lazy (non-greedy) matching instead of the default greedy matching.

正規表現テスター

リアルタイムマッチングで正規表現をテストします

//g

Frequently Asked Questions

ECMAScript、RE2、PCRE2エンジンの違いは何ですか?

ECMAScriptはJavaScriptの標準正規表現エンジンです。RE2(Go、Googleで使用)は高速で線形時間を保証しますが、後方参照や先読みなどの機能がありません。PCRE2(PHP、Nginxで使用)は最も機能が豊富で、再帰、条件付きパターンなどをサポートします。

'g'(グローバル)フラグは何をしますか?いつ使うべきですか?

'g'フラグなしでは、正規表現は最初のマッチで停止します。'g'ありではすべてのマッチを検索します。すべての出現箇所を検索・置換する必要がある場合に'g'を使用してください。注意:JavaScriptでは'g'をtest()と使用するとlastIndexの状態により不整合な結果が生じることがあります。

複数行にまたがるテキストをマッチさせるには?

デフォルトでは^と$は文字列全体の先頭/末尾にマッチし、.は改行にマッチしません。'm'(multiline)フラグを有効にすると^と$が行の境界にマッチします。's'(dotAll)フラグを有効にすると.が改行文字にもマッチします。


Related Tools