Regex Quick Reference
The most common regex patterns. Click copy to paste directly into the find field.
Common Find & Replace Tasks
One-click presets for the most common text cleanup operations.
Strips whitespace at the end of every line
Replace straight double quotes with curly opening quotes
Replace 3+ consecutive newlines with a double newline
Strips whitespace at the start of every line
Replace multiple consecutive spaces with a single space
Convert tab characters to two spaces
Batch Operations Guide
Use advanced regex patterns to handle complex text transformations in a single pass.
The Complete Guide to Find & Replace
How to Find and Replace Text Online
Find and replace is one of the most fundamental and essential text editing operations. Whether you are writing a report, editing source code, or cleaning up data, the ability to search for and replace strings of characters quickly will save you hours of manual work. This online find and replace tool processes everything in your browser and never sends your data to any server.
To get started, paste your text into the editor area, enter the string you want to find in the Find field, enter the replacement string in the Replace with field, and click Replace All. All matches are highlighted in yellow in real time so you can preview exactly what will change before committing. You can also use Replace First to change only the first occurrence and verify the result before proceeding.
Using Regular Expressions
Regular expressions (regex) are a powerful pattern-matching language that lets you search for complex patterns rather than simple literal strings. When you enable the Regex toggle in this tool, the Find field interprets your input as a regular expression instead of a plain string.
For example, \d+ matches any sequence of digits (1, 42, 1000), [A-Z][a-z]+ matches words starting with a capital letter, and \b\w+@\w+\.\w+\b matches simple email addresses. You can also use capture groups in your search pattern and reference them in the replacement string using $1, $2, and so on.
- Capture groups: Wrap part of your pattern in parentheses
(pattern)to capture the matched text. For example,(\w+)@(\w+)captures the username and domain name separately. - Backreferences: In the Replace field, use
$1for the first group,$2for the second. For instance, find(\w+), (\w+)and replace with$2 $1to swap two words separated by a comma. - Character classes:
[aeiou]matches any vowel,[^aeiou]matches any non-vowel character. Use\dfor digits,\wfor word characters, and\sfor whitespace. - Quantifiers:
+(one or more),*(zero or more),?(zero or one),{3}(exactly 3 times),{2,5}(between 2 and 5 times).
Common Text Cleanup Tasks
Most real-world find and replace needs revolve around cleaning up and normalizing text. Here are the most common tasks you can accomplish with this tool, along with the exact patterns to use:
- Remove trailing whitespace: Use the regex
\s+$with an empty replacement to strip whitespace at the end of every line. This is especially common when cleaning up code or data pasted from other sources. - Normalize quotes: Replace straight double quotes
"with curly quotes, or vice versa depending on your typographic conventions. Some style guides require curly quotes in published text but straight quotes in code. - Collapse blank lines: Use
\n{3,}to find three or more consecutive newlines and replace them with\n\n(a single blank line). This keeps your document clean without removing all paragraph breaks. - Convert tabs to spaces: Replace
\twith two or four spaces depending on your code style. This ensures consistent indentation across editors and platforms. - Strip HTML tags: Use the regex
<[^>]+>to remove all HTML tags from text, leaving only the plain text content behind. This is invaluable when extracting readable text from web pages.
Find and Replace for Code and Data
Developers and data analysts frequently need to perform complex find and replace operations on source code and datasets. This tool is particularly useful for the following scenarios:
- Variable renaming: Enable Whole Word matching to change only the exact variable name without affecting words that contain it as a substring. For example, replacing "count" with "total" should not change "counter" or "recount".
- Data format conversion: Use capture groups to reformat dates (DD/MM/YYYY to YYYY-MM-DD), swap column positions in CSV data, or convert between camelCase and snake_case naming conventions.
- API response normalization: Change field names, convert between naming conventions, or restructure JSON data by selectively replacing key names while preserving values.
- SQL query generation: Convert a list of values into an IN clause by replacing newlines with commas and wrapping in parentheses. This saves significant time when building filter queries from spreadsheet data.
- Log file analysis: Extract specific fields from log entries using regex capture groups, or redact sensitive information like IP addresses and email addresses before sharing logs with team members.
Tips for Accurate Text Replacement
Bulk text replacement can introduce unintended changes if you are not careful. Here are some tips to ensure your replacements are accurate and safe:
- Always preview before replacing: Check the match count and review the highlighted areas before clicking Replace All. If the count seems higher or lower than expected, your pattern may be matching too broadly or too narrowly.
- Enable Whole Word when needed: Avoid replacing substrings within larger words. For example, replacing "cat" without Whole Word will also change "category", "concatenate", and "scatter".
- Use Replace First to test: Replace one match at a time before committing to replacing all occurrences. This lets you verify the result is correct before making bulk changes.
- Keep a backup: Before making large-scale replacements on important text, copy the original to a safe location. This tool does not modify files on your computer, but it is still good practice to have a backup.
- Start simple with regex: A regex pattern that is too complex can match more or fewer strings than you expect. Start with a simple pattern, verify the matches, then gradually add complexity. Test with a small sample before running on large text.
- Watch for greedy vs. lazy matching: By default, quantifiers like
*and+are greedy, meaning they match as much text as possible. Add?after the quantifier (e.g.,.*?) for lazy matching that stops at the first possible match.
Frequently Asked Questions
More Text Tools
Case Converter
Convert text between 11 case formats: UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case, and more. Instant copy, free.
Remove Duplicate Lines
Remove duplicate lines from text instantly. Case-sensitive or insensitive matching, trim whitespace, sort output. Free, browser-based, no signup.
Word Counter
Count words, characters, sentences, paragraphs, reading time, and speaking time in real time. Free for writers, students, and SEO professionals.
Character Counter
Count characters, words, UTF-8 bytes, and lines in real time. Check Twitter, SMS, and SEO limits instantly.
Slug Generator
Convert any text into clean, SEO-friendly URL slugs. Supports multilingual transliteration, bulk mode, custom separators. Free, instant.
Diff Checker
Compare two text blocks side by side. Added lines green, removed lines red, unchanged gray. Ignore-whitespace and case-insensitive options. Free, private, browser-based.
All Text Tools
Word Counter
Count words, characters, sentences, paragraphs, reading time, and speaking time in real time. Free for writers, students, and SEO professionals.
Character Counter
Count characters, words, UTF-8 bytes, and lines in real time. Check Twitter, SMS, and SEO limits instantly.
Slug Generator
Convert any text into clean, SEO-friendly URL slugs. Supports multilingual transliteration, bulk mode, custom separators. Free, instant.
Case Converter
Convert text between 11 case formats: UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case, and more. Instant copy, free.
Fancy Text Generator
Generate 20+ Unicode text styles instantly — bold, italic, script, bubble, small caps. Copy and paste into any social media bio.
Lorem Ipsum Generator
Generate classic Lorem Ipsum placeholder text by paragraphs, sentences, or words. Copy instantly for wireframes and typography testing.
Text to Speech
Convert any text to speech with 100+ voices, adjustable speed, pitch, and volume — right in your browser. Free, private, no signup.
Remove Duplicate Lines
Remove duplicate lines from text instantly. Case-sensitive or insensitive matching, trim whitespace, sort output. Free, browser-based, no signup.
About Text Tools
Text tools handle the daily grind of working with strings, paragraphs, and documents: counting words, reversing characters, transforming case, generating slugs, splitting long text, previewing Markdown. These replace separate desktop apps and complex CLI commands with a single URL you can bookmark and use without setup.
Why it matters
Writers, editors, and content teams work with text constraints everywhere — Twitter's 280-char limit, LinkedIn's 1,300-char optimal post, academic abstracts of 250 words, SEO meta descriptions capped at 155. A word counter that shows characters (with and without spaces), words, sentences, paragraphs, and reading time lets you hit platform specs without switching between tools.
Privacy and safety
Text tools process input entirely in your browser. Your blog draft, legal contract, or confidential email never leaves your device. Even the word counter doesn't transmit your text — it runs a simple counting function locally, which is actually all that's needed. If a text tool claims to 'process' your text on their server, the scope for data leakage is enormous and almost never justified.
Best practices
- For SEO titles, aim for 50-60 characters including spaces (Google truncates longer titles)
- Meta descriptions work best at 150-155 characters — Google has been showing ~160 on desktop, ~120 on mobile
- When generating slugs, keep them short (3-5 words), all lowercase, hyphens-not-underscores, avoid stop words
- Markdown preview is useful BEFORE publishing to verify headings, links, and lists render correctly on the target platform