正規表現ビルダー

正規表現を視覚的に作成・テストします。

リアルタイムエンジン
/
/g
7 件一致
Hello World! This is a Regex Test with Multiple Matches.

テンプレート

正規表現チートシート
\d任意の数字
\w任意の単語文字
.任意の文字
*0回以上
+1回以上
^ / $先頭 / 末尾

このビルダーを使う理由

ライブハイライト入力するとプレビュー画面に一致箇所が視覚的に表示されます。
標準RegEx最大の互換性のためV8 JavaScriptエンジンを使用します。
ゼロオーバーヘッド重いIDEを開かずにスニペットをすばやくテストできます。

Demystifying Regular Expressions

Overview

Regular expressions are a tiny domain-specific language for matching text patterns. They turn problems like 'find all email addresses' or 'extract date strings' into one-liners — but the cryptic syntax intimidates many developers. This builder helps you compose regex patterns visually, see live matches on test text, and learn the syntax piece-by-piece. It supports JavaScript's regex flavor (closest to most other modern engines).

How It Works

Type a pattern in the regex field; type test text in the test area. As you type, the tool highlights every match in real time. Groups and named groups are color-coded. The tool generates explanation text for each part of your pattern ('\d+ matches one or more digits') and warns about common mistakes (greedy quantifiers, missing escapes, unintended character classes).

When to Use This

Validating form input (email format, phone numbers, postal codes). Extracting data from log files. Find-and-replace in code editors. Building URL routing patterns. Parsing user-entered text. Sanitizing HTML or SQL. Splitting CSV with quoted fields. Designing regex for use in another tool (sed, grep, your code).

Frequently Asked Questions

Why does my regex match too much / too little?

Most common issue: greedy quantifiers. '.*' matches as much as possible; use '.*?' for lazy matching. Also check for character class issues — '[a-z]' doesn't match uppercase; '[a-zA-Z]' or the 'i' flag does.

When should I NOT use regex?

Parsing HTML or XML (use a DOM parser). Parsing nested structures (regex can't handle arbitrary nesting). Parsing email addresses to RFC spec (the full regex is 6000+ characters). Use proper parsers for these.

Are regex patterns portable across languages?

Mostly, but with edge cases. PCRE (PHP), Java, Python, JavaScript share most syntax. POSIX regex (basic sed/grep) lacks features like \d or non-capturing groups. Always test in the target environment.

おすすめのツール

役に立つかもしれない厳選されたツール