Regular expressions — regex — have a reputation for being intimidating. And to be fair, something like (?<![\p{L}\p{N}_])(\w+)(?![\p{L}\p{N}_]) does look like keyboard mash. But for the kinds of replacements most people actually need in a browser, regex is simple and enormously powerful.
Rewritr supports full Unicode-aware regex in every rule. This guide walks from zero to practical patterns.
Enabling regex mode
To activate regex for a rule, click the Rx button on that row. The phrase input turns yellow — that's your visual signal that the field is now interpreted as a pattern, not a literal string.
The basics: matching patterns instead of fixed text
In literal mode, Rewritr searches for the exact string you type. In regex mode, you describe a pattern of characters to match.
The most useful basic building blocks:
\d— any digit (0–9)\d+— one or more digits\d{4}— exactly four digits[A-Z]— any uppercase letter.— any single character.*— zero or more of any character (greedy)cat|dog— either "cat" or "dog"
Example: replace all US-style phone numbers with a redacted placeholder:
Pattern: \d{3}[-.\s]\d{3}[-.\s]\d{4}
Replace: [REDACTED]
This matches 555-867-5309, 555.867.5309, and 555 867 5309 equally.
Capture groups: rearranging text
This is where regex becomes genuinely magical for browser use. Wrap part of your pattern in ( ) to create a capture group, then reference it in the replacement as $1, $2, and so on.
Example: convert date formats
American websites display dates as MM/DD/YYYY. If you prefer the ISO format YYYY-MM-DD:
Pattern: (\d{2})/(\d{2})/(\d{4})
Replace: $3-$1-$2
Example: 03/15/2025 → 2025-03-15
Three capture groups: $1 = month, $2 = day, $3 = year. The replacement just rearranges them.
Example: anonymise email addresses
Pattern: ([\w.+-]+)@([\w-]+\.[a-z]{2,})
Replace: ***@$2
Example: john.doe@example.com → ***@example.com
Example: expand abbreviations
Pattern: \bAPI\b
Replace: API (Application Programming Interface)
Practical patterns for everyday browsing
| Pattern | Replace | What it does |
|---|---|---|
| \$(\d+) | ₹$1 | Convert USD amounts to INR symbol (for re-labelling, not conversion) |
| (\d+)px | $1rem | Convert pixel values to rem on CSS docs |
| https?://\S+ | [link] | Redact all URLs for clean screenshots |
| \b(he|him|his)\b | they/them | Replace gendered pronouns (add Sc flag for capitalisation) |
| (\d{4})-(\d{2})-(\d{2}) | $3/$2/$1 | Reformat ISO dates to DD/MM/YYYY |
| \bTODO\b | ⚠ TODO | Highlight to-do items in code documentation |
Using $0 — the full match reference
In addition to numbered capture groups, $0 always refers to the entire matched string. Useful for wrapping text:
Pattern: \b[A-Z]{2,}\b
Replace: [$0]
Example: The CEO and CFO met → The [CEO] and [CFO] met
Flags that interact with regex
- Cs (Case Sensitive) — by default, Rewritr's regex is case-insensitive (
iflag). Enable Cs to remove theiflag and match case exactly. - Sc (Smart Case) — also works with regex. The replacement will mirror the capitalisation of each match.
- Ww (Whole Word) — disabled in regex mode. Use explicit boundary assertions instead:
(?<![\p{L}\p{N}_])before and(?![\p{L}\p{N}_])after your pattern.
Unicode regex — it just works
Rewritr compiles all patterns with the u (Unicode) flag, which enables Unicode property escapes. This means you can write patterns that work correctly across scripts:
Pattern: \p{Script=Devanagari}+
Replace: [Hindi text]
This matches any run of Devanagari characters — something that's impossible with ASCII regex.
Summary
Regex mode in Rewritr gives you pattern matching, capture groups for rearranging text, and full Unicode support — in a UI that takes seconds to use. Start with a simple pattern like \d+ to match numbers, and build up from there. The most powerful patterns don't have to be long or complex.
Try Rewritr free — regex mode is included in the free tier.