開発ツール

正規表現テスト

パターン、グループ、置換をテストします。

正規表現テスト

UtilBrix が提供

JavaScript regular expressions. Processing runs in a worker and stops after 3 seconds. Quick reference: \d digit, \w word, \s whitespace, + one or more, * zero or more, ^ start, $ end.

入力内容はブラウザ内で処理されます。アカウントは不要です。

詳しい方法と使用例は英語で提供しています。

Step-by-step instructions (English)

  1. Enter a JavaScript regular-expression pattern and the desired flags.
  2. Paste representative test text, including examples that should not match.
  3. Optionally enter a replacement string, then inspect matches, groups, indexes, and replacement output.

計算式と方法

The browser executes JavaScript RegExp semantics in a dedicated worker. Match details include text, zero-based UTF-16 indexes, captured groups, and named groups. The replacement string follows JavaScript replacement conventions, including $1 and named references.

使用例

The pattern \d+ with flag g finds 12 and 34 in order 12, item 34. A worker timeout stops patterns that take too long.

When this tool is useful

Develop a pattern for text extraction or cleanup before adding it to an application. Testing both matching and nonmatching examples helps catch a pattern that works on one sample but accepts too much.

Common mistakes and limitations

  • Regular-expression syntax and flags differ between languages; this tool uses JavaScript semantics.
  • A pattern can be expensive on long input. The worker time limit protects the page, but a timeout means the pattern needs review.

Practical questions about this tool (English)

Why am I seeing only one match?

Check the global g flag if you intend to find repeated matches. Other flags such as i and m affect case sensitivity and line boundaries rather than enabling all matches.

What do match indexes count?

Indexes are zero-based UTF-16 positions, matching JavaScript string indexing. Some visible symbols occupy multiple code units, so the index can differ from a visual character count.

関連ツール

UtilBrixをインストール

ホーム画面からツールをすぐに開けます。

  1. ブラウザのメニュー(⋮)を開きます。
  2. 「アプリをインストール」または「ホーム画面に追加」を選びます。
  3. 確認してUtilBrixをホーム画面に追加します。

項目がない場合はAndroid版Chromeで開いてください。

ツールを検索

↑ ↓ Navigate · Enter Open · Esc Close