Skip to tool
FeuTex · free tools runs in-browser no bloat built by LiMiT

Regex Checker (Bash)

Use this tool to quickly test a regex the way you’d typically use it in Bash (for [[ string =~ regex ]]) or with grep, then inspect matches, indexes, and capture groups. It also generates copy-ready shell snippets.

Category: Developer · URL: /tools/regex-checker-bash.html
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.
Keywords this page targets (natural cluster): regex checker bash, bash regex test, bash [[ =~ ]] regex, bash regex match groups, BASH_REMATCH regex tester, grep -E regex checker, grep extended regex tester, posix ere checker, bash regex replace example, grep regex debug, shell regex tester, regex match index bash, regex capture groups bash, bash regex validate, bash regex quick test, regex to grep command, bash pattern match tester, check regex against text, regex replace tool, grep -P vs -E regex
Secondary intents covered: Test whether a pattern matches a given string in Bash-like usage, See all matches, positions, and capture groups for debugging, Generate a correct Bash snippet using [[ =~ ]] and BASH_REMATCH, Generate a grep command line (grep -E) for the same regex, Quickly try a replacement and preview the output, Catch obvious syntax errors before running a script, Learn how quoting affects regex in Bash (snippet guidance)

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.