Find and Replace With Regex: A Cookbook for Writers and Editors
Tested regex find-and-replace recipes for editors: double spaces, curly quotes, date formats, trailing spaces and repeated words, plus safe testing.
Tip: press / anywhere to search.
8 articles in this category.
Tested regex find-and-replace recipes for editors: double spaces, curly quotes, date formats, trailing spaces and repeated words, plus safe testing.
Find and remove invisible characters such as zero-width spaces, BOMs, soft hyphens and bidi controls. Learn where they come from and how to clean them.
Remove punctuation from text for NLP, data cleanup and keyword lists. Learn when to keep apostrophes, hyphens and periods, plus Unicode-aware regex.
Strip HTML tags to extract clean plain text. Learn what gets removed, regex vs DOM parsing, why stripping is not XSS protection, and how our tool works.
Remove empty lines and blank lines from text, or collapse them to one. Learn why they pile up, what style guides allow, and the regex for each method.
Remove line breaks from text copied from PDFs and emails while keeping paragraphs. Learn the difference between CR, LF and CRLF and how to fix each one.
Remove extra spaces, double spaces, tabs and non-breaking spaces from text. Learn where irregular whitespace comes from and how to clean it up safely.
Remove duplicate lines from lists, CSV rows and logs. Learn case-sensitive vs case-insensitive matching, keeping order vs sorting, and how it works.