Regex Replace
Find and replace text using regular expressions with capture groups.
About Regex Replace
Regex Replace performs powerful find-and-replace operations on text using JavaScript-compatible regular expressions with full support for capture groups, named groups, lookaheads, lookbehinds, and all standard regex flags. It is far more flexible than literal text search-and-replace, enabling you to match and transform complex text patterns, reorder captured substrings, and process entire documents in a single operation. The tool provides real-time match highlighting so you can see exactly what the pattern matches before committing to the replacement. It supports the global (g), case-insensitive (i), multiline (m), dotAll (s), and Unicode (u) flags.
How to Use
Enter your source text in the top input area, type a regular expression pattern in the search field, and provide a replacement string using $1, $2, or named groups $<name> to reference captured groups. Set regex flags such as g for global replace, i for case-insensitive matching, or m for multiline anchor behavior using the flags checkboxes. Click Replace to apply the substitution and see the result. The match count is shown so you know how many substitutions were made. Copy the output from the result panel.
Common Use Cases
- Reformatting date strings from MM/DD/YYYY to ISO 8601 YYYY-MM-DD format across entire log files or CSV exports
- Stripping HTML tags from scraped content while preserving the inner text of each element using a capture group replacement
- Renaming JavaScript variable names or function identifiers consistently across a pasted code snippet using word-boundary anchors
- Extracting and rearranging structured data fields using named capture groups to reorder columns in delimited text
- Cleaning log file lines by removing ISO timestamps, log level prefixes, and thread identifiers to extract the core message text