How to Find and Replace Text: Whole Words, Regex and Line Breaks
Learn how to find and replace text in bulk: plain, whole word and regex modes, capture groups, line breaks and tabs. Checked against Python on 9,000 cases.
Copied text often arrives with stray line breaks, repeated lines, odd spacing and the wrong case. These guides show how to clean it up fast, from removing duplicates and sorting lines to find-and-replace and regular expressions, with a free tool for each job.
Learn how to find and replace text in bulk: plain, whole word and regex modes, capture groups, line breaks and tabs. Checked against Python on 9,000 cases.
Learn how to add line numbers to text: where to start, what to do with blank lines, how to line numbers up, and when to use letters. Checked against GNU cat.
Learn how to add quotes and commas to a list for a SQL IN clause or a JSON array, without a trailing comma, with quotes escaped. Tested on 3,000 lists.
Learn how to extract numbers from text without splitting 1,234.56, losing 10km or adding up dates. Reads US, European, Indian and Swiss number formats.
Learn how to extract URLs from text and keep full stops, brackets and quotes out of the result. Tested on 588 cases, with a free extractor and a short regex.
How to extract phone numbers from text: the formats to match, why dates, IP addresses and IDs fool a simple regex, and results tested on 245 countries.
How to remove extra spaces from text: double spaces, tabs, non-breaking and zero width characters, and why JavaScript and Python disagree about which count.
How to sort lines alphabetically online or in code, and why 10 lands before 9, how case and language change the order, checked against Python.
camelCase vs snake case vs kebab-case: which style each language and URL expects, the rules from PEP 8 and Google, and how to convert names correctly.
Compare two text files line by line online, with git or in PowerShell. Why every line can show as changed, and how a diff finds the shortest edit.
A regex cheat sheet where every example was run in JavaScript and Python, with 10 differences between them and how to avoid patterns that freeze.
How to extract email addresses from text with a free tool, JavaScript or Python, tested on 20 tricky inputs, plus why a common regex can freeze a page.
Remove duplicate lines from text with a free tool, Excel, PowerShell, sort or awk. See which methods keep your order, ignore case and miss trailing spaces.
Remove line breaks from copied text in seconds. Fix PDF, Word, Google Docs and Excel pastes, keep your paragraphs, repair split hyphens, and use a free tool.