正規表現テスター
正規表現パターンをテストし、マッチ結果とキャプチャを確認できます。
Enter a pattern and text.
What is Regex Tester?
Regex Tester lets you write and test regular expressions against any text in real time. It shows all match positions and capture groups so you can debug patterns quickly without running code.
How to use
- Enter your regex pattern in the Pattern field (without leading/trailing slashes).
- Optionally add flags in the Flags field. Common flags:
g(global),i(case-insensitive),m(multiline). - Paste the text you want to test in the Test Text area.
- Matches and their character positions appear in the result area immediately.
Notes
- Uses JavaScript's built-in
RegExp. Syntax follows the ECMAScript standard. - Without the
gflag, only the first match is returned. - Backslashes in the pattern field do not need to be doubled (e.g., use
\d, not\\d).
FAQ
- What regex flavor does this use?
- JavaScript ECMAScript regex. This is compatible with most modern languages for basic patterns, but advanced features like lookbehind with variable length may differ from PCRE (Python, PHP).
- How do I match a literal dot?
- Escape it with a backslash:
\.. An unescaped dot matches any character except a newline. - What are capture groups?
- Parentheses create capture groups, e.g.
(\w+)@(\w+). The result shows extracted group values alongside the full match.
概要
正規表現パターンをテキストに対して検証し、マッチ結果を確認できます。入力検証、ログ解析、抽出条件の調整に有効です。
使い方
- パターンと対象テキストを入力します。
- g/i/m などのフラグを設定します。
- 実行してマッチ結果とグループを確認します。
使用例
-
メール形式の簡易抽出
入力: Pattern: \w+@\w+\.\w+
出力: メールらしき文字列を抽出
-
行頭判定
入力: Pattern: ^ERROR (mフラグ)
出力: 各行のERRORを検出
補足
- 実行系により正規表現仕様差があります。
- 過度に曖昧なパターンは遅延の原因になります。
- バックスラッシュのエスケープを確認してください。
よくある質問
- マッチしない原因は?
- アンカー、フラグ、エスケープミスを先に確認してください。
- gフラグの意味は?
- 最初の1件だけでなく全件検索します。
- フリーズすることはありますか?
- バックトラッキングが重いパターンでは遅くなることがあります。
Embed this tool
Paste this iframe into any HTML page to embed 正規表現テスター on your site: