Hello Stephen,
In my opinion, Stephen, you didn’t understand, exactly, the use of the . matches new line option. By default, with the regex engine of N++, the special character dot . matches ANY character DIFFERENT from the 3 characters, below :
The New Line character, displayed as LF, = \n ( \x0a )
The Carriage Return character, displayed as CR, = \r ( \x0d )
The Form Feed character, displayed as FF, = \f ( \x0c )
So, when you CHECK the option . matches new line, then the dot matches, absolutely, ALL the characters of a file. This option allows the user to build multi-lines searches.
For instance, the regex 123.*789 with the .matches new line set, tries to match the longest string, from a first occurrence of 123 to the last occurrence of 789, in the current file, even though the string 789 is located some lines after the string 123 :-)
So, as you can see, this option has no relation, at all, with the search of spaces, anyway !
To achieve your S/R ( Multiple spaces -> ONE space ), that’s quite easy :
SEARCH = +, with TWO spaces before the + sign and REPLACE = ONE space
The search regex matches a single space, followed by a non null sequence of spaces. An other syntax would be :
SEARCH = \x20\x20+ and REPLACE = \x20 ( decimal number 32 = hexadecimal number 20 )
You could also use a look-behind to detect the first space :
SEARCH = (?<= ) +, with a space after the = sign and before the + sign and REPLACE = Nothing.
However, due to a bug of the regex engine, you must click on the Replace All button, ONLY. Don’t use the Replace button, for the S/R, just above.
Best Regards
guy038
P.S. :
You’ll find good documentation, about the new Boost C++ Regex library, v1.55.0 ( similar to the PERL Regular Common Expressions, v1.48.0 ), used by Notepad++, since its 6.0 version, at the TWO addresses below :
http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html
http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html
The FIRST link explains the syntax, of regular expressions, in the SEARCH part
The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part