Closed chuanliwen closed 4 months ago
Notepad3 uses Oniguruma (Ruby syntax flavor) as its RegEx engine. (ref. for RegEx questions: https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean/)
And here the different syntax flavors for interpretation of \s
: https://stackoverflow.com/questions/9291474/how-to-choose-between-whitespace-pattern/21067350#21067350
I don't like to change the meaning of the \s
(and \S
) in this Ruby regex flavor, but I like the idea of using \h
for 'horizontal whitespace' (resp. \H
for non-horizontal-white-space-character).
Unfortunately Oniguruma (Ruby) RegEx engine uses \h
for matching any hexadecimal-digit.
So I decided to change the Ruby flavor for this for Notepad3 to make \h
matching any 'horizontal-white-space-character' and \H
matching non-horizontal-white-space-character. (PR #5132)
I hope this doesn't collide with expectations of other NP3/Oniguruma users.
I hope, you can cope with using \h
instead of \s
for your needs.
Well then, I will be looking forward to the implementation of the \h option. Thanks.
Hello @chuanliwen ,
Feel free to test the "BETA/RC PortableApps", version "Notepad3Portable_6.24.302.1_rc2.paf" or newer, see in issue #1129.
"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.
Also, feel free to test the "BETA/RC Setup", version "Notepad3_6.24.302.1_rc2_Setup" or newer, see the 2nd list in issue #1129.
Comments and suggestions are welcome... 😃
@hpwamr @RaiKoHoff Hi, I have tested the new build Notepad3_6.24.302.1_rc2. The related issues seems to be solved.
I made a search and found issue #282, my question is the same. This question about regex "\s" has puzzled me for quite some time. I know by definition it does include blank, tab, CR, LF, and so on. But when you want to replace the real spaces (0x20 and \t) in the text, you replace the EOL characters too. It is very inconvenient.
EmEditor treats "\s" this way: normally it only process spaces within lines, before the EOL marks. When you want to process the EOL marks, you do it explicitly (by using \r and/or \n).
In Notepad3, if you want to deal with the spaces but not the EOL marks, you have to use a regex like "[ \t]". We could do with this, though it is a little awkward, while a simple "\s" could do it otherwise.
I also found in Notepad3, when the EOL mark is "\r\n" (0xd 0xa), you can find and replace "\r\n", "\r" but not "\n". But with a single "\r" or "\n" as EOL, you could find and process them both.
I hope this could be further improved by some modification.