Find and replace text with full regex support in your browser. Replace literal strings or use regex patterns with configurable flags for complex text edits.
This example demonstrates the find and replace operation from String Tools, pre-loaded with a simple replacement scenario. Paste any text, enter a search pattern (literal or regex), and specify the replacement string. The output updates instantly as you type.
The tool splits your input into lines and applies the search/replace operation across the entire text. When regex mode is enabled, the search field is interpreted as a regular expression pattern. The replacement field can include backreferences ($1, $2) to reference captured groups.
In literal mode, special characters lose their regex meaning. A search for file.txt matches exactly those characters. In regex mode, the dot matches any single character, so file.txt would also match file1txt or fileAtxt.
| Pattern | Use Case |
|---|---|
\\s+ |
Match one or more whitespace characters |
\\bword\\b |
Match whole word only |
(?i)pattern |
Case-insensitive match (or use the flag toggle) |
(capture) |
Capture a group for use in replacement |
[^a-zA-Z] |
Match any non-letter character |
Say you have comma-separated values with inconsistent spacing:
name , age , city
Alice , 30 , New York
Bob , 25 ,San Francisco
Search for \\s*,\\s* (comma surrounded by optional whitespace) and replace with , to normalize all separators. Then search for ^\\s+|\\s+$ with the multiline flag to trim leading and trailing spaces from each line.
Yes. The tool shows the transformed output in real time. Each replacement is reflected immediately so you can verify the result before copying it.
Wrap your search text in the regex escape sequence: each special character (. * + ? [ ] ( ) { } ^ $ | \) should be preceded by a backslash. Or use literal mode, which treats all characters as plain text.
If a regex pattern matches an empty string (e.g., a*), the tool replaces each empty match and moves forward, which can produce unexpected results. Use a+ instead to require at least one character.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.