Monu Tools

正規表現テスター

正規表現をリアルタイムでテキストに対してテストします。すべてのマッチをハイライト表示し、キャプチャグループとフラグを表示します。すべてブラウザ内で実行されます。

正規表現テストの使い方

  1. 01

    パターンフィールドに正規表現を入力してください。

  2. 02

    必要なフラグ(g、i、m、s、u)を切り替えてください。

  3. 03

    テスト文字列を入力すると、マッチがグループとともにハイライト表示されます。

What the regex tester does

The regex tester lets you build and debug regular expressions against your own sample text, with matches highlighted live as you type. It is useful for validating input formats, extracting fields from logs, or testing a pattern before pasting it into code.

Everything runs in your browser, so your patterns and test text are never uploaded.

Which engine it uses

It uses the JavaScript regular-expression engine, the same one in every browser and in Node.js, so a pattern that works here works in your JavaScript and TypeScript code.

Flags and capture groups

Toggle the global, case-insensitive, multiline and other flags to change how a pattern matches. You see every match along with its capture groups, so you can confirm exactly what each part of the pattern is pulling out.

Differences across regex flavors

Other languages such as PCRE, Python and Go share most syntax but differ in some features, so a few advanced constructs may behave differently outside JavaScript. If a pattern works here but not in another language, an engine-specific construct is usually the reason.

よくある質問

どの正規表現エンジンを使用していますか?

ブラウザに組み込まれたJavaScript(ECMAScript)エンジンを使用しているため、JavaScriptやTypeScriptのコードと同じ結果が得られます。

フラグはどういう意味ですか?

gはすべての出現をマッチ、iは大文字小文字を無視、mは^と$を改行でマッチ、sはドットが改行にもマッチ、uは完全なUnicode処理を有効にします。

複数行にわたるマッチはどうすればよいですか?

マルチライン(m)フラグを有効にして^と$が各改行でマッチするようにし、ドットが改行文字にもマッチする必要がある場合はdotAll(s)フラグも追加してください。

キャプチャグループは表示されますか?

はい。各マッチは番号付きキャプチャグループを一覧表示し、名前付きグループは名前で表示されるため、パターンの各部分がキャプチャしたものを正確に確認できます。

パターンがここでは機能するのに別の言語では機能しないのはなぜですか?

これはJavaScriptエンジンを使用しています。PCRE、Python、その他は構文の多くを共有しますが、後読み、名前付きグループ、一部のエスケープが異なるため、高度なパターンは注意して移植してください。

テキストはアップロードされますか?

いいえ。パターンとテストテキストはすべてブラウザ内で評価され、お使いのデバイスから出ることはありません。

出典

このツールを埋め込む

このツールをご自身のウェブサイトに追加できます。下のコードをコピーしてください。内容は自動的に最新の状態に保たれます。

<iframe src="https://monu.tools/embed/ja/regex-tester" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

関連ツール