JavaScript regex on one side, Python `re` on the other. No mental translation.
You wrote a regex in JavaScript: `/(\w+)@(\w+\.com)/gi`. Now you need the same pattern in a Python script. You sit there for ten minutes wondering whether `i` becomes `re.I` or `re.IGNORECASE`, whether named groups still work the same way, whether Python understands lookbehind the way JS does. Useless friction every time.
Paste the JS regex on the left, you get `re.compile(r"...", re.IGNORECASE)` on the right. With the right flag mapping, the right named-group syntax (`(?<name>...)` → `(?P<name>...)`), and a list of warnings when something does not translate cleanly: variable-width lookbehind, atomic groups, the sticky `y` flag, the global `g` flag.
Three modes in one tool: JS → Python, Python → JS, and inline `(?i)` ↔ `re.IGNORECASE` for moments when you just need to read someone's pattern. Plus a live tester below each panel: paste a sample, see the matches highlighted, with one click you copy the result. Everything happens in your browser, your pattern never leaves the page.
How to use it
- Pick a mode in the segmented bar at the top: JS → Python if you have a JavaScript regex and need Python, Python → JS the other way, Inline flags ↔ re.flags when you just want to translate flag notation.
- Paste the pattern on the left. For JS accept the full literal (`/.../flags`) or just the body, the parser figures out which one it is. For Python paste either the raw pattern or a full `re.compile(r"...", re.I | re.M)` call.
- Read the right panel. You get the converted code in a copy-ready block, with the original flags translated to the other engine.
- Check the warnings section. Every difference that matters (the `g` flag, sticky, lookbehind width, named-group syntax) appears as a short note so you know what to watch out for.
- Switch the output format. For Python you can choose between full `re.compile(...)` and a plain pattern + flag list. For JS, between the literal `/.../flags` and `new RegExp("...", "...")`. Pick whichever paste target you have.
- Use the tester at the bottom: paste a sample text, the engine runs the regex live and highlights the matches. Note that the tester uses the JS engine on both sides, advanced features behave the way they do in V8.
- Click a sample under the input to prefill a typical case (email, URL, date with named groups, lookbehind). Useful for sanity-checking the converter before you trust it on your own pattern.
When this is useful
Five situations where the converter saves five to fifteen minutes and a tab full of Stack Overflow:
- Porting a frontend validator to the backend. You have a JS regex for emails or phone numbers in a form, and you need the same check in a Python API endpoint. Paste, get `re.compile(...)`, the warnings tell you whether `g` matters or whether your named groups work on the target Python version.
- Reading a script in a language you do not normally write. You inherited a `scraper.py` full of `re.findall(r"(?P<title>.+?)</h1>", html, re.S)` and you want to test the pattern quickly in DevTools. Paste it into Python → JS, copy the `/.../` literal, drop it into the browser console.
- Translating Stack Overflow answers. Half of the regex answers on the internet use Python syntax even when the question is about JS, and the other way round. The converter is faster than rewriting by hand and catches gotchas like `(?P<name>...)` you would otherwise miss.
- Working with the `x` / `re.VERBOSE` flag. A coworker wrote a beautiful multi-line Python regex with comments using `re.VERBOSE`. JS has no such mode. The converter warns you up front and shows the flat version you can paste.
- Migrating between Python versions. You wrote `(?<name>...)` in Python 3.12 and a coworker still runs 3.10. Paste it in any mode, the converter rewrites it to the safer `(?P<name>...)` and adds a warning so the change is intentional.