match · capture · replace · explain

The regex workbench that actually shows you what's happening

Tool Tips:
Bin paste your raw material here
Cast your result

Regex patterns tested against real data stay in your browser. Live match feedback shows you what a pattern does while you type — not after you submit it.

Live feedback, not a submit button

Most documentation shows a finished regex and tells you it works. RuneCipher updates every match, every capture group, and every flag change the moment you type. Learning regex by watching it react in real time is significantly faster than guessing, submitting, and reading a cryptic error.

Your test data stays private

Regex patterns are often written against real content — production strings, user records, or API responses. Running those patterns client-side means the test data never reaches a server. Sensitive content you wouldn't email to a stranger shouldn't pass through an unknown server either.

Capture groups explained by the result

The output shows not just what matched, but which group captured it and what the group is named. For those newer to regex: capture groups let you extract a specific piece of a match — like pulling just the area code from a phone number, or the domain from an email address — without hand-parsing the full string.

Share a pattern with a URL

Your pattern, flags, and test string are encoded in the page URL as you type. Copy the URL to share a working regex example with a colleague, paste it into a ticket, or bookmark a pattern you use regularly — no account needed.

What regular expressions are and what they do

A regular expression (regex) is a pattern that describes a set of strings. The engine checks whether a target string contains a substring matching that pattern — and if so, reports where each match starts and ends, extracts the content of capture groups, and can substitute matches with replacement text. Regex is one of the most compressed forms of logic in software: a dozen characters can express rules that would take fifty lines of string parsing code. RuneCipher compiles the pattern in real time as you type, highlights every match in the test string with character precision, and explains each token in the pattern so you can read unfamiliar expressions without consulting a reference.

Flags and what each one changes

Five flags modify how the engine interprets a pattern. g (global) finds all matches instead of stopping at the first. i (case-insensitive) makes letter matches ignore case. m (multiline) makes ^ and $ match the start and end of each line rather than the whole string. s (dotall) makes . match newlines, which it normally skips. u (unicode) enables full Unicode support and makes \u{...} code point escapes valid. RuneCipher shows the active flag string as you toggle each one so the complete expression is exactly what you would paste into code.

Capture groups, named groups, and back-references

Parentheses capture matched text and make it accessible by index: $1 is the first pair, $2 the second. Named groups (?<name>...) label the captured value, making replacement strings and surrounding code readable — $<name> in a replacement or \k<name> for a back-reference within the same pattern. Non-capturing groups (?:...) group subexpressions for quantifiers or alternation without consuming a capture slot. RuneCipher reports every match with its full set of capture groups — index, name, start position, end position, and value — so you can verify extraction logic before it reaches production.

Lookaheads, lookbehinds, and zero-width assertions

Lookaheads and lookbehinds match a position in the string without consuming characters — they are called zero-width assertions. (?=...) asserts what follows; (?!...) asserts what does not follow. (?<=...) asserts what precedes; (?<!...) asserts what does not precede. They let you write patterns like "a digit followed by a percent sign" and have only the digit appear in the match result. RuneCipher's token explainer highlights each lookahead and lookbehind in a distinct color and describes it in plain English on hover, making complex patterns readable without memorizing the notation.

Regex: a pattern language for finding things in text

A regular expression is a way to describe what you’re looking for rather than searching for a specific word. Instead of searching for “error” in a log file, you write a pattern that finds any line starting with a timestamp followed by the word ERROR and captures the message after it. Instead of checking word-by-word if a string looks like an email address, you describe the shape of an email — characters, then @, then more characters, then a dot, then a domain. RuneCipher lets you write and test these patterns against real text, showing you exactly which parts matched and what was captured.

The on/off switches that change how matching works

By default, a pattern finds the first match and stops, treats uppercase and lowercase as different, and doesn’t consider line breaks specially. Flags change these behaviors. The global flag keeps going after the first match and finds all of them. The case-insensitive flag makes “Error”, “error”, and “ERROR” all match the same pattern. The multiline flag makes the start-of-line and end-of-line markers work per line rather than for the whole block of text. You stack them together — RuneCipher shows you the exact combination as you toggle each one.

Capture groups: grabbing specific parts from a match

When you put parentheses around part of a pattern, you’re telling the engine to save whatever matched there separately. If your pattern matches a date like “2024-03-15”, groups can capture the year, month, and day individually. Named groups let you label those captures instead of numbering them, making your code much more readable. RuneCipher shows you every capture from every match — the exact text, where it starts and ends, and which group it came from.

Matching by position, not just text

Sometimes you want to find text only when it appears next to something specific — a number followed by a percent sign, a word that doesn’t appear at the start of a line. Lookaheads and lookbehinds let you check what’s adjacent to a match without including that surrounding text in the result. Think of it as “find this, but only when X is right next to it” — where X doesn’t end up in what’s found. They’re one of the more confusing regex features, which is why RuneCipher’s token explainer calls each one out in plain English when it appears in your pattern.