When find and replace says 0 matches but you can see the text, the characters in the file are almost always different from the ones you typed, or the file was never searched. The usual culprits are invisible characters (non-breaking spaces, tabs), look-alike quotes and dashes, HTML entities, line endings, match options left switched on, regex special characters, file encodings, and file filters that skip the file. Work through the nine causes below in order; most problems are solved by the first four.
First, narrow it down
- Search for a shorter part of the text, such as one distinctive word. If that matches, the problem is in the part you removed.
- Search in one file you know contains the text. If that works, the problem is the file filter or scope, not the text.
- Turn off Match case, Whole word and Regex, then turn them on again one at a time.
These three checks point you to the right section below.
1. Invisible characters
Text copied from web pages, Word or PDFs often contains characters that look like ordinary spaces but are not:
- Non-breaking space (U+00A0), common after copying from a browser or Word.
- Tabs instead of spaces, or several spaces instead of one.
- Zero-width characters such as U+200B, which take no space at all.
- Trailing spaces at the end of a line in a multi-line search.
Fix: in regex mode, replace each space in your search with \s+, which matches any run of whitespace, including tabs and non-breaking spaces in .NET and most modern engines. To find stray characters, search for \u00A0 or \u200B in a tool that supports Unicode escapes (.NET, PowerShell and VS Code do), or use [^\x00-\x7F] to find every non-ASCII character.
2. Look-alike quotes, apostrophes and dashes
Word processors and CMS editors convert straight quotes to curly ones and hyphens to longer dashes. Don't typed with a straight apostrophe will not match Don’t with a curly one, even though they look nearly identical.
Fix: match either form with a class. For apostrophes, Don['\u2019]t. For dashes, [-\u2013\u2014] matches a hyphen and the two common typographic dashes. For double quotes, ["\u201C\u201D].
3. HTML entities
A web page shows Fish & Chips, but the HTML file may contain Fish & Chips. The same applies to (non-breaking space), ", ' and accented letters written as entities such as é.
Fix: open the source file, not the browser view, and copy the text from there. Search for the entity form if that is what the file contains.
4. Line breaks and multi-line searches
If your search spans more than one line, line endings and indentation must match exactly. Windows files use \r\n, others use \n, and the next line's indentation may be tabs or spaces.
Fix: switch to regex and replace each line break with \r?\n\s*. Our guide to replacing multiple lines of text in multiple files has full patterns.
5. Match case and whole word
- Match case on: Widget will not find widget or WIDGET.
- Whole word on: widget will not find widgets, and searches that start or end with a symbol, such as .NET or C++, may find nothing at all because there is no word boundary next to the symbol.
Fix: turn these off to confirm the text exists, then decide which you need. See find and replace whole word only for the symbol edge cases.
6. Regex special characters (or the wrong mode)
In regex mode, . ^ $ * + ? ( ) [ ] { } | \ have special meanings. Searching for price (USD) in regex mode looks for "price USD" with a group around USD, not the brackets. Searching for C:\Data treats \D as "any non-digit".
The reverse also happens: you type a pattern like \d+ while the tool is in plain-text mode, and it searches for a literal backslash followed by d+.
Fix: check the mode. For literal text containing symbols, use plain-text mode or escape each symbol with a backslash. In PowerShell, [regex]::Escape('price (USD)') does it for you. More in regex replace not working.
7. File encoding
- UTF-16 files store every character in two bytes. Tools that read them as single-byte text find nothing.
- Accented characters in ANSI files do not match the same characters typed into a tool reading the file as UTF-8, and the reverse.
Fix: check the encoding in your editor's status bar. Use a tool that detects encodings per file, or, in PowerShell, read with the correct -Encoding. If the characters already look garbled in the file, see special characters broken after find and replace.
8. The file was never searched
- Extension filter:
*.htmdoes not include.html.*.jsdoes not include.jsxor.mjs. - Subfolders off: the file sits one level deeper than the search reaches.
- Excluded folders: VS Code skips anything in
.gitignore,files.excludeandsearch.excludeby default. - Hidden files: PowerShell's
Get-ChildItemskips hidden items unless you add-Force; other tools have a hidden-files option. - Size or date filters left on from a previous job.
Fix: search for the text with no filters in the one folder you know contains it, then add filters back one by one.
9. The text is not in a plain-text file
- Word, Excel and PDF files are compressed or binary formats. Text find and replace tools cannot see inside them, and well-behaved tools skip them.
- Minified files may store the text with escaped characters, such as
\u00e9for an accented e. - Generated text: on a website, the words you see may come from a database, a CMS, a JavaScript file that builds the page, or a translation file, not from the HTML file you are searching.
See exactly what matches before you replace
Most of these problems are easy to spot when you can see the match list. In Bulk Replace, the preview lists every matching file and the total match count before anything is written, so a count of zero (or far fewer than expected) tells you to fix the search first. Each rule can be plain text, wildcard or regex, with case-sensitive and whole-word options you can toggle per rule, and each file's encoding (UTF-8, ANSI or UTF-16) is detected rather than assumed. Bulk Replace skips binary files automatically, and the extension, size, date and hidden-file filters are all visible in one place, which makes cause 8 quick to rule out.
Frequently asked questions
Why does search miss text I can see on screen?
The characters on screen may not be the ones in the file. Non-breaking spaces, tabs, curly quotes or HTML entities like look the same in a browser but are different text.
Why does a search work in one file but not others?
The other files may be excluded by the filter, saved in a different encoding, or use different line endings or quote characters.
Why do my regex special characters not match?
Characters like . ( ) [ ] ? + * have special meanings in regex. Escape them with a backslash, or switch the search to plain text mode.
