Favorite places of your favorite city
Home
Add to preferred sources on Google

JavaScript Regex Tester

Enter a raw JavaScript pattern and sample text, choose the flags, then test explicitly. Inspect the current matches and capture values without uploading your text.

Input

Enter the raw JavaScript pattern, without enclosing slashes or a flags string.

The exact field value is tested locally in your browser.

Flags

Pattern: up to 2,048 UTF-16 units; text: up to 100,000. Results and reports also have limits.

Matches

Test a pattern to see results here.

The tool processes your pattern and text in a browser worker without adding an upload, input history or content-bearing URL. Copy and download happen only when you choose them; the report contains your full pattern and text.

Test a pattern in three steps

  1. Enter the pattern without surrounding slashes or a trailing flags string, then enter your test text. Empty patterns and empty text are allowed.
  2. Choose the flags. All matches and Unicode mode start enabled; turn All matches off when you want only the first match.
  3. Select Test pattern. Inspect the matches, positions and captures, then optionally copy or download the complete current report, which includes your full input.

Read matches and captures accurately

A full match is the text accepted by the entire pattern. Parentheses can also capture values; a group that did not participate is different from one that matched an empty string.

Start positions count from zero and end positions are exclusive. Positions use JavaScript UTF-16 code units, so an emoji can occupy two positions even with Unicode mode enabled.

Multiline changes line anchors; Dot matches line breaks changes the dot. Unicode mode changes parsing and empty-match advancement, but does not make the usual word shorthand include every language's letters.

Values are shown in quoted JSON-string notation so empty, invisible and surrogate characters remain distinguishable. The exported report uses ASCII escapes and preserves the admitted pattern and text.

Examples worth checking

For pattern (\d+) and text Order 42, item 7, All matches returns 42 at [6,8) and 7 at [15,16), with each number also in capture 1. First match only returns 42.

An empty pattern on one emoji returns empty matches at positions 0 and 2 with All matches and Unicode mode. Without Unicode mode, it also returns one at position 1.

For pattern (a)?() on empty text, the full match is empty. Capture 1 is unmatched, while capture 2 participated and contains an empty string.

Scope and limits

This tool uses your browser's JavaScript regex engine with g, i, m, s and u flags. It does not offer PCRE, Python, replacement, capture positions or a guarantee of identical behavior across engines and versions.

Patterns are limited to 2,048 UTF-16 units and text to 100,000. Complete results allow at most 500 matches, 256 numbered and 256 named captures per returned match, and a 1 MiB report. Exceeding a limit produces no partial report.

A separate worker has a nominal two-second operation budget, including startup and reporting. Browser scheduling can delay cancellation, and a timeout does not prove that a pattern is invalid or unsafe.

This is a text-inspection aid, not a proof that a regex is safe, fast, secure or correct for every input. First match only reports the requested first result, not an exhaustive nonzero total.

Local handling

The tool processes your pattern and text in a browser worker without adding an upload, input history or content-bearing URL. Copy and download happen only when you choose them; the report contains your full pattern and text.

JavaScript regex questions

No. Enter only the raw pattern and choose the separate flag controls. Slashes you enter are part of the pattern; they are not automatically removed.

JavaScript positions count UTF-16 code units, not visible characters. One emoji can use two units. Unicode mode affects matching and advancement, not the unit used by reported indices.

An unmatched group did not participate. An empty capture participated but consumed no text. The report keeps separate states instead of silently dropping either value.

No. Valid patterns can exceed the operation budget, especially on difficult input or slower browsers. The tool stops that job and provides no partial report.

No. A successful sample match does not prove general correctness, security or runtime complexity. Results describe this browser engine and the particular admitted text.

The complete current JSON report, including the exact admitted pattern and text, flags, full matches, capture states and UTF-16 positions. It is not a saved editor session or an executable script.

Sources and references

JSON to YAML

Convert JSON to YAML locally while preserving number text and quoted strings; copy or download the complete result.

Open tool — JSON to YAML

YAML to JSON

Convert one YAML document locally to JSON with exact number text and bounded aliases, then copy or download the complete result.

Open tool — YAML to JSON

HTML to Markdown

Convert pasted or local HTML into Markdown, review conversion notes, and copy or download the result.

Open tool — HTML to Markdown

Markdown to HTML

Convert a Markdown draft to an HTML fragment, inspect the source and inert preview, then copy or download it.

Open tool — Markdown to HTML

Text Sorter

Sort lines alphabetically by a chosen language or by Unicode code point, keeping duplicates, blank rows and complete line contents.

Open tool — Text Sorter

Remove Duplicate Lines

Keep the first copy of each exact text line, preserving order, significant spaces and blank rows, then copy or download the result.

Open tool — Remove Duplicate Lines

Text Diff Checker

Compare two drafts locally, with exact whole-line changes, visible whitespace rules and clear final-newline handling.

Open tool — Text Diff Checker

Case Converter

Convert text to uppercase, lowercase, capitalized words or sentence case with explicit letter rules.

Open tool — Case Converter

HTML Entity Encoder/Decoder

Encode or decode literal HTML references with explicit context, Unicode options and LF output, without parsing or rendering markup.

Open tool — HTML Entity Encoder/Decoder

Markdown Table Generator

Edit a small literal-text table, set alignment and copy GFM Markdown or import tab-separated text.

Open tool — Markdown Table Generator

Query String Parser & Builder

Edit ordered URL parameters, retain repeated names and copy a normalized query or HTTP(S) URL.

Open tool — Query String Parser & Builder

URL Encoder & Decoder

Convert a UTF-8 URL component or form value with explicit space and plus rules, then copy or download the result.

Open tool — URL Encoder & Decoder

Base64 Encoder & Decoder

Encode UTF-8 text as standard or URL-safe Base64, or decode either format with clear errors and complete text output.

Open tool — Base64 Encoder & Decoder

XML Formatter

Check namespace-aware XML 1.0, format or compact locally, and copy or download UTF-8 output.

Open tool — XML Formatter

JSON Formatter & Validator

Check JSON syntax, format or minify locally, and copy or download output while preserving original data tokens.

Open tool — JSON Formatter & Validator

SMS Character Counter & Segment Calculator

See how your message is encoded, where its segments end and what it may cost. Your text stays in your browser.

Open tool — SMS Character Counter & Segment Calculator

Social Media Character Counter

Check platform-specific limits and split posts without losing text.

Open tool — Social Media Character Counter

Character Counter

Count characters, words, sentences and paragraphs. Check word density, reading time and UTF-8 size, all in your browser.

Open tool — Character Counter

Text Size Calculator

Compare text encodings and payload sizes in your browser.

Open tool — Text Size Calculator

PDF Text Cleaner

Fix line breaks and spacing in text copied from a PDF. Preserve your original and review ambiguous hyphens before copying the cleaned text.

Open tool — PDF Text Cleaner

Fancy Text Converter

Convert supported fancy Unicode letters to normal text locally. Keep case, accents, emoji and your original text.

Open tool — Fancy Text Converter

Garbled Text Fixer

Fix garbled text and repair broken accents with a browser-based mojibake fixer. Review each possible UTF-8 reversal before applying it.

Open tool — Garbled Text Fixer

Gmail Clipping Checker

Measure email HTML bytes in UTF-8, compare them with an advisory 102,000-byte Gmail reference, and inspect size contributors locally.

Open tool — Gmail Clipping Checker
View all tools in this category