Remove double spaces at end of line in Notepad++
Posted: Sat Feb 16, 2019 10:09 am
The regular expressions area of the search and or replace function in Notepad++ can be daunting unless you know how to mingle and modify from one program to another with different REGEX variations.
Regex help reference for Notepad++
http://blog.hakzone.info/posts-and-arti ... nt-page-1/
http://docs.notepad-plus-plus.org/index ... xpressions
load a list of names for example, generated online that has hidden double spaces at the end of each line before the newline characters
look in notepad++ with the option view->show symbol->show all characters
the first and last name will have a single orange dot between them and two dots at the end before the newline CR LF
CR is carriage return LF is line feed, like an old dot matrix printer or CMD prompt as example
now select all the text, CTRL+A keys
CTRL+F to find
CTRL+H to replace
try to find first to learn where they are
in Find What type [ ]
choose search mode -> regular expression button
choose Find Next to go one at a time, or Count to see how many single and double spaces there are (all single finds)
Now, if you choose Replace or CTRL+H, look for [ ][ ]
again make sure you have chosen search mode->regular expression
and replace with choose the area and make sure you delete everything, replace with nothing
Since the single space [ ] which has the space character between the brackets finds any single space
You can simply do it twice without spaces in between
that will effectively find all instances of the double space and replace with nothing, aka remove them leaving single spaces alone.
Regex help reference for Notepad++
http://blog.hakzone.info/posts-and-arti ... nt-page-1/
http://docs.notepad-plus-plus.org/index ... xpressions
load a list of names for example, generated online that has hidden double spaces at the end of each line before the newline characters
look in notepad++ with the option view->show symbol->show all characters
the first and last name will have a single orange dot between them and two dots at the end before the newline CR LF
CR is carriage return LF is line feed, like an old dot matrix printer or CMD prompt as example
now select all the text, CTRL+A keys
CTRL+F to find
CTRL+H to replace
try to find first to learn where they are
in Find What type [ ]
choose search mode -> regular expression button
choose Find Next to go one at a time, or Count to see how many single and double spaces there are (all single finds)
Now, if you choose Replace or CTRL+H, look for [ ][ ]
again make sure you have chosen search mode->regular expression
and replace with choose the area and make sure you delete everything, replace with nothing
Code: Select all
[ ]
You can simply do it twice without spaces in between
Code: Select all
[ ][ ]