Search Ctrl K
Home / Tools
THE FEUTEX TOOLKIT

Bash Regex Snippet Builder with JavaScript Preview

JS match/replace preview Bash/grep snippets shell quoting ERE incompatibility warnings. compileRegex executes JavaScript RegExp even for Bash/grep engine choices. generateSnippet adds a real shell quoting workflow; label preview accurately and separate compatibility from execution.

Scope of this tool: compileRegex executes JavaScript RegExp even for Bash/grep engine choices. generateSnippet adds a real shell quoting workflow; label preview accurately and separate compatibility from execution.

This tool runs locally in your browser. Matching is done with the browser regex engine; results are closest to the selected mode, but edge cases may differ from your exact Bash/grep build.
Common: g (all matches), i (ignore case), m (multiline), s (dotall). For Bash mode, m/s don’t map 1:1.
Tip: paste multiple lines; use flag m if you want ^/$ to act per-line (JS behavior).
Bash note: In real Bash, quoting changes behavior. For [[ $s =~ regex ]], don’t put the regex in quotes unless you want a literal string match.
Privacy: runs locally in your browser. No uploads, no tracking scripts.

How to use

Quick workflow:

  1. Select Mode (Bash [[ =~ ]] or grep -E).
  2. Enter a Regex and your Input text.
  3. Click Test to list matches and groups (add flag g to list all).
  4. Optionally enter a Replacement and click Replace.
  5. Use Generate snippet to copy a Bash/grep example.

FAQ

Is this an exact Bash [[ =~ ]] engine?

No—matching runs with your browser’s regex engine; the tool focuses on fast debugging and snippet generation, with warnings where Bash/ERE commonly differs.

Why does my Bash regex fail when I put it in quotes?

In [[ $s =~ regex ]], quoting the regex turns it into a literal string comparison; generally leave the regex unquoted.

Does grep -E support \d or \w?

No; POSIX ERE uses character classes like [0-9], [[:alpha:]], and [[:alnum:]].

How do I get capture groups in Bash?

After [[ $s =~ re ]], use ${BASH_REMATCH[0]} for the full match and ${BASH_REMATCH[1]}, [2], etc. for groups.

Why do I only see one match?

If you don’t use flag g, the tool shows the first match only; add g to list all matches.

Can I test multiline patterns here?

Yes; paste multiple lines and use m for JS-style multiline behavior, but note Bash/grep may handle newlines differently.

Is my text uploaded anywhere?

No; everything runs locally in your browser and this tool does not make network requests.

Continue your workflow

Browse related tools by task. Use the improved core tools for a consistent workspace with file import, downloads and clear validation errors.