Search and replace not working properly ...
-
I have for months been successfully transferring text from PDF documents to N++ and stripping the CR&LF that appears after each word by searching for \r\n and replacing with \s with the extended option ticked.
Yesterday this stopped working. I deleted my install and downloaded the latest version to find the same problem which is that the CR&LF are replaced by a literal \s inserted before each word.
Any idea of what is happening here? -
Debug info is here if it is useful:
Notepad++ v7.3.1 (32-bit)
Build time : Jan 17 2017 - 00:21:10
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : ON
Local Conf mode : OFF
OS : Windows 7
Plugins : mimeTools.dll NppConverter.dll NppExport.dll NppFTP.dll PluginManager.dll -
I don’t know about the “Extended” Search Mode as I have no experience with it. I see little use for it since Regular Expression mode was added in version 6.0 – my guess is that extended mode is still retained for people that are accustomed to using it.
Why don’t you try doing your Search-and-Replace this way?:
Find what:
\r\n
Replace with:\x20
Mode:Regular expression
You could enter simply a single space into the “Replace with” box, but as that would be hard to show in red above, I opted for the hex version of a single space (the \x20). Either way will work.
-
Normal text search not working for me too… Find next button doesn’t show anything, while “Find all in current document” shows the occurrences correctly.
-
Occasionally I leave the “In selection” tick box on the replace window ticked, then I get very confused about why a replace does not do what I want. Unticking the “In selection” box and shouting at my mouse for clicking the wrong things lets the replacement work OK.
-
@Scott-Sumner said:
\x20
by the way, please tell me.
x20
is the same thing asone space
between words? -
@Scott-Sumner said:
You could enter simply a single space into the “Replace with” box, but as that would be hard to show in red above, I opted for the hex version of a single space (the \x20). Either way will work.
Was that unclear? or just not read?
-
@Scott-Sumner said:
a single space into the “Re
hello. I read, only that I made a regex and
\x20
was not working as aspace
. -
Create a UTF-8 document with some “word” data in it. For example, copy-n-paste the content of this posting.
Get to the Find dialog’s Replace tab:
- Find what:
\w
- Replace with:
\x20
- Search mode:
Regular expression
- Wrap around:
checked
- Uncheck all other checkboxes on Replace tab.
Press the Replace button one or more times. Each press replaces a word character with a single space character.
- Find what: