Hack the Hydra

Regex tester

Put the regular expression on the first line, as /pattern/flags or just the pattern, and the text to test on the following lines. Every match is listed with its line number, position and capture groups.

🔒 Private by design: the conversion runs in this browser tab. Nothing is uploaded.

Regex tester is a free online tool by Hack the Hydra. Test a regular expression against your text: every match with its line, index, numbered and named groups, plus an optional replace preview. JavaScript regex syntax, runs in your browser.

100% freeNo upload: runs in your browserNo sign-up
Regex tester: the tool with a sample file converted

Syntax and flags

The tester uses the JavaScript regular expression engine of your browser, the same one as Node.js and most front-end code. The g flag is always added so that every match is listed. Add i for case-insensitive, m so that ^ and $ match at each line, s so that . also matches newlines, and u for full Unicode. Named groups (?<name>...) and lookbehind (?<=...) are supported.

Reading the result

Each match shows its number, the line it starts on, its character index in the text and the matched text in quotes, so spaces and empty matches are visible. Capture groups follow, numbered from 1; a group that took part in no match shows "(not matched)". Results stop after 500 matches to keep the page responsive.

Replace preview

Type a replacement to see the whole text after replace. Use $1, $2 for numbered groups, $<name> for named groups and $& for the whole match. Other languages (Python, PCRE, Java) share most of this syntax, but details differ, for example named groups are written (?P<name>...) in Python.

Example

Finding ISO dates with three capture groups, then reformatting them with the replacement $3/$2/$1.

Input

/(\d{4})-(\d{2})-(\d{2})/
Order 2026-11-10 shipped
Invoice 2025-01-31 paid

Output

#1  line 1, index 6: "2026-11-10"
    group 1: "2026"
    group 2: "11"
    group 3: "10"
#2  line 2, index 33: "2025-01-31"
    group 1: "2025"
    group 2: "01"
    group 3: "31"

After replace:
Order 10/11/2026 shipped
Invoice 31/01/2025 paid

How to use

  1. On the first line type the regex, for example /(\d+) items/i.
  2. Paste the text to search below it.
  3. Read the matches and groups. Optionally type a replacement to preview the replaced text.

FAQ

Why do I get many empty matches?

Your pattern can match zero characters, for example x* or \d*. Use + instead of * when at least one character is required.

Is my text sent anywhere?

No. The regex runs in your browser tab, so logs or data with personal information stay on your computer.

Does it support Python or PCRE syntax?

It uses JavaScript syntax. Most patterns are the same; check the details listed above when you move a regex to another language.

How do I match a literal slash or dot?

Escape it with a backslash: \/ or \. . A bare pattern on the first line (without surrounding slashes) does not need the slash escaped.

More free converters

PDF to Markdown converterOCR PDF: scanned PDF to textImage to text (OCR)Word (DOCX) to Markdown converterExcel & CSV to Markdown tablesHTML to Markdown converterPowerPoint (PPTX) to Markdown converterJSON to Markdown tablePDF to text converterExcel to JSON converterMarkdown to HTML converterMerge PDF filesSplit PDF: extract pagesRotate PDFJPG to PDF converterPDF to JPG converterImage converter: PNG, JPG, WebPCompress image: JPG and WebPQR code generatorWord counterCase converterJSON formatter and validatorBase64 encode and decodeURL encoder and decoderUUID v4 generatorStrong password generatorLorem ipsum generatorJSON to CSV converterRemove duplicate linesUnix timestamp converterJSON to YAML converterText diff checkerImage resizerPercentage calculatorAge calculatorHash generator (SHA-256, SHA-1, SHA-512)Color converter: HEX, RGB, HSLDays between dates calculatorYAML to JSON converterUnit converterJWT decoderBinary, hex, decimal and octal converterRoman numeral converterCron expression explainerPDF to Markdown for ChatGPTPDF to Markdown for ClaudePDF to Markdown for RAG pipelinesPDF to Markdown for ObsidianPDF to Notion (via Markdown)Screenshot to textFrench OCR: image to textCSV to Markdown tableGoogle Docs to MarkdownJPG / JPEG to text (OCR)PNG to text (OCR)CSV to JSON converterPNG to JPG converterJPG to PNG converterWebP to PNG converter