正規表現フレーバーコンバーター (PCRE / JS / Python / Go)
ガイド
Regex Flavor Converter
Convert regular expressions between programming language flavors: PCRE (PHP), JavaScript, Python, Go, Java, and Ruby. Automatically converts named groups, flags, backreferences, and other syntax differences. Highlights incompatible features with clear warnings. Includes a test panel to validate your converted regex against sample strings.
使い方
Enter your regex pattern, select the source flavor (the language it’s written for) and the target flavor (the language you want to convert to). The converted regex appears instantly with any flags translated. Check the conversion notes for changes made and warnings about unsupported features. Use the test panel to validate the converted pattern against sample text.
特徴
- 6 Regex Flavors — PCRE (PHP), JavaScript (ES2018+), Python (re module), Go (regexp), Java (java.util.regex), and Ruby. Convert between any pair.
- Named Group Conversion — Automatically converts between (?P<name>…) (PCRE/Python/Go) and (?<name>…) (JS/Java/Ruby) syntax.
- Flag Translation — Converts flags between flavors: /gi (JS) ↔ re.IGNORECASE (Python) ↔ (?i) inline (PCRE/Go) ↔ Pattern.CASE_INSENSITIVE (Java).
- Backreference Conversion — Named backreferences converted: (?P=name) ↔ \k<name> between flavors.
- Incompatibility Warnings — Color-coded alerts: green for clean conversions, yellow for syntax changes, red for unsupported features (e.g., Go doesn’t support lookbehind, JS doesn’t support atomic groups).
- Test Panel — Test the converted regex against sample strings. Shows matches, groups, and match count using JavaScript’s RegExp engine.
- Syntax Reference — Collapsible reference table showing key differences between all flavors: named groups, lookahead/lookbehind, flags, character classes, atomic groups, Unicode support.
- Auto-Convert — Results update instantly as you type or change flavors.
What Gets Converted
Named groups: (?P<name>) ↔ (?<name>) syntax differences.
Named backreferences: (?P=name) ↔ \k<name> ↔ \g{name}.
Flags: Inline (?imsx), suffix /gi, and language-specific constants.
Lookbehind assertions: Supported in PCRE/JS/Java, limited in Python/Ruby, unsupported in Go.
Atomic groups: (?>…) — PCRE/Java/Ruby only; warned for JS/Python/Go.
Possessive quantifiers: a++ — PCRE/Java/Ruby only.
Character classes: \R, \h, \v (PCRE-specific) flagged for other flavors.
コメント: (?#…) syntax — PCRE/Python only.
Conditionals: (?(cond)yes|no) — PCRE only.
Why do regex flavors differ between languages?
What regex features can’t be converted?
Is the test panel accurate for all flavors?
What is the difference between PCRE and JavaScript regex?
恵 スコアボードが到着しました!
スコアボード ゲームを追跡する楽しい方法です。すべてのデータはブラウザに保存されます。さらに多くの機能がまもなく登場します!
