Toolivaro

無料の正規表現テスター

正規表現を自分のテキストに対してリアルタイムでテストします。マッチのハイライト、キャプチャグループ、フラグに対応し、完全にローカルで動作します。

正規表現テスターは、パターンの検証と、入力したテキストに対するすべてのマッチの表示を、サーバーへの往復なしで、入力するたびに即座に行います。テキストを貼り付けるか入力し、パターンを入力し、標準のフラグ(グローバル、大文字小文字を無視、マルチライン、ドットオール、ユニコード、スティッキー)を切り替えると、各マッチがその位置、マッチしたテキスト、生成されたキャプチャグループとともに一覧表示されます。パターンはプラットフォームの ECMAScript の RegExp エンジンでコンパイルされるため、ここでテストした動作は、JavaScript、Node.js、そしてすべてのモダンブラウザで得られる動作とまったく同じです。このツールが約束するのはエンジンとの忠実性であり、似せた方言ではありません。不正なパターンはプラットフォームのエラーメッセージを返すので、素早く修正できます。また、マッチ走査には安全上の上限があり、病的なパターンでページがフリーズするのを防ぎます。すべてブラウザ内のローカルで処理されるため、貼り付けたテキスト(ログの抜粋、設定、個人データ)がアップロードされたり、ログに記録されたり、保存されたりすることはありません。バリデーターを書くとき、ログパーサーをデバッグするとき、本番コードでパターンに頼る前にご利用ください。

ブラウザ内でローカル処理されます

フラグ

この計算機の使い方

Building a pattern the way the engine sees it

A regular expression is a miniature program: the engine walks your text, and at every position it asks whether the pattern matches starting there. The tester makes that walk visible — every match is listed with its position, the exact text it matched, and the capture groups it produced, updated as you type. Start with the literal that must appear (request_id=, say), add the flexible parts around it (a w+ for the value), and check the result against real lines from your data before you trust it anywhere.

The engine here is the platform’s ECMAScript RegExp — the same one JavaScript, Node.js, Deno, and every modern browser use. That is the point of the tool’s fidelity promise: a pattern that matches here matches in your code, and one that fails here will fail there. Dialects like PCRE (PHP, grep, regex101’s default) have features ECMAScript lacks or spells differently — lookbehind syntax, named-group conventions, atomic groups — and the tester rejects them with the platform’s error message rather than pretending to support a dialect it does not run.

Using the flags deliberately

Flags are not decorations — they change what the pattern means. Without g, the engine stops at the first match, and the classic "why does my pattern match once?" confusion is usually a missing g. Without m, the anchors ^ and $ bind to the whole string, not to line boundaries, so a pattern that should match each log line silently matches nothing when the text has multiple lines. The s flag is the one that surprises everyone: . matches every character except line breaks unless s is set, so patterns that should span lines fail on the newline. And the difference between the unicode u and non-unicode modes changes how astral characters like emoji are treated — a point where the ECMAScript engine is stricter than older dialects.

The tester shows the flags you have set at a glance and re-runs the scan on every change, so each flag’s effect is visible the moment you toggle it. That is the fastest way to learn what a flag does: switch it, watch the match list change.

Reading matches, groups, and failures

Each result row shows the matched text, its start position, and its capture groups — the parts of the pattern inside parentheses, which are the values your code will actually consume. The classic use is extraction: with /request_id=(w+)/g against a log line, group 1 holds the id, and the tester shows both matches and their group values before you wire the pattern into a pipeline.

A pattern that matches nothing is a bug report, not a puzzle: the tool shows every match position so the failure is visible at a glance — the pattern matched a different place than you expected, or matched zero times because of a missing flag, a literal space, or an anchor bound to the wrong position. Malformed patterns return the platform’s own error message, which names the position of the problem, so fixing is a matter of reading the message rather than guessing.

Safety and the honest limits

Regular expressions can be pathological: certain patterns take exponential time on certain inputs — the classic "catastrophic backtracking" failure mode — and the tester caps match scanning so a hostile pattern cannot freeze the page. The cap is disclosed; extremely large texts or pathological patterns are truncated with a notice rather than run to completion.

Two things the tool deliberately does not do: it does not judge whether a pattern is efficient enough for production traffic (that is a load-testing question), and it does not claim your pattern is correct in the abstract — it shows what the engine does with your text, which is the only honest answer. And because patterns and pasted text often contain credentials and personal data, everything runs locally: nothing is uploaded, logged, or stored.

結果はどうやって計算されるの?

ログ行から ID を抽出する

"2026-08-05 09:30 ERROR request_id=7f3a user=ada" のようなログ行に対し、パターン /request_id=(\w+)/g は各リクエスト ID にマッチし、その値をグループ 1 にキャプチャします。テスターは両方のマッチを位置とキャプチャグループ付きで一覧表示するため、ログパイプラインで使う前にパターンを確認できます。

入力と出力の例
入力
text 2026-08-05 09:30 ERROR request_id=7f3a user=ada 2026-08-05 09:31 ERROR request_id=9c21 user=bob
pattern request_id=(\w+)
flags g
結果 2 件のマッチ ・ グループ 1: 7f3a, 9c21

計算式と前提は?

マッチのセマンティクス

matches = text.scan(pattern, flags)

計算式の記号
記号 意味
pattern ECMAScript の正規表現(プラットフォームの RegExp エンジン)
flags g(グローバル)、i(大文字小文字を無視)、m(マルチライン)、s(ドットオール)、u(ユニコード)、y(スティッキー)

動作はプラットフォームのエンジンとまったく同じで、ここでマッチするものは JavaScript、Node.js、ブラウザでもマッチします。

よくある間違いは?

  • g フラグでテストしながら最初の結果しか見ないこと。/g ではエンジンはすべてのマッチを順に進みます。
  • ECMAScript のパターンに PCRE の機能(ES2018 より前の後読みなど)を期待すること。
  • s フラグがない限り . が改行にマッチしないことを忘れること。
  • 秘密情報を含むパターンやテキストを Web サービスに貼り付けること。このツールは完全にローカルで動作します。

前提と制限は?

  • 方言は ECMAScript のみです。ECMAScript にない PCRE/RE2 風の機能は、プラットフォームのエラーで拒否されます。
  • 安全のためマッチ走査には上限があります。極端に大きなテキストや病的なパターンは、通知付きで打ち切られることがあります。
  • このツールが示すのはエンジンのマッチ結果であり、パターンが本番ワークロードに対して効率的か安全かは判定できません。

数値の出典は?

最終確認 2026年8月5日 · バージョン 1.0.0 · Toolivaro 外部コンテンツを保証するものではありません。

よくある質問

このツールが使う正規表現の方言は何ですか?

プラットフォームの ECMAScript エンジンです。JavaScript、Node.js、Deno、ブラウザが使うのと同じ方言です。PCRE(PHP、grep、regex101 のデフォルト)などの方言には、別の形式の後読みや別の構文の名前付きグループなど追加機能がありますが、それらは ECMAScript には含まれません。

パターンが何もマッチしないのはなぜですか?

よくある原因は、複数マッチを期待しているのに g フラグが付いていないこと、^ や $ のようなアンカーが m フラグなしでは行境界にマッチしないこと、意図せずリテラルの空白が入っていることです。このツールはすべてのマッチを位置付きで表示するため、失敗の原因はたいてい一目でわかります。

テキストはどこかに送信されますか?

いいえ。パターンとテキストはブラウザのタブ内だけで処理され、アップロード、ログ記録、保存は一切行われません。認証情報や個人データを含むことの多いログの抜粋や設定ファイルの扱いには重要です。

What does the u (unicode) flag actually change?

It switches the engine to strict Unicode mode: astral characters (emoji, rare scripts) are treated as single code points instead of surrogate halves, and some otherwise-lenient syntax becomes an error. Patterns that work without u can behave differently with it — the tester makes the difference visible as you toggle.

Can I use the same pattern in Python or Go?

Not safely — those languages use different engines (Python’s re, Go’s RE2). The fidelity promise here is specifically ECMAScript: what matches here matches in JavaScript, Node.js, Deno, and browsers. Porting a pattern to another language means re-testing it in that language’s tester.

このコレクションの一部 開発者向けテキスト・JSONツールキット

間違いを見つけましたか? 報告する — すべての修正を確認します.

このツールは役に立ちましたか?

Toolivaro編集チームが当社の方法論に基づいてレビュー済み 計算方法 · 編集方針