Notepad3: regex issue with line ends

Created on 9 Oct 2020  路  4Comments  路  Source: rizonesoft/Notepad3

to reproduce (notepad3 v5.20.915.1) have

line1
line2

open the Replace (ctrl+H) dialog
check Regular expression search
for Search String use: .*
for Replace with use: test
click Replace All button

Notepad3 reports 4 changes were made (?!?)
resulting text is:

testtest
testtest

(Also strange is that the Occ count shows "5" before the replacement is performed)

馃悶 bug

All 4 comments

It seems that Oniguruma Regex Engine got wrong settings: carriage-return (CR) (\r) control-character is no longer recognized as part of Windows line-break tupel. If you activate "View->Show Line Endings (Ctrl+Shift+9), you will see what happened.

Hello @np3fan ,

Feel free to test the "BETA/RC paf" version "Notepad3Portable_5.20.1012.2_beta.paf" or higher, see below or issue #1129.

"Notepad3Portable BETA/RC paf" version can be used with or without ".7z" extension.
To update your "Notepad3 Setup" version with the latest features/fixes from the "BETA/RC" version, see issue #1105.

Also, feel free to test the "BETA/RC Setup" version "Notepad3_5.20.1012.2_beta_Setup" or higher, see below or issue #1129.

Comments and suggestions are welcome... 馃槂

Oniguruma RegEx engine has been designed for Unix line-breaks NEW_LINE (LF, '\n', 0x0A). The NEWLINE_CODE macro can be used to change this line-break character to CARRIAGE_RETURN (CR, '\r', 0x0D) for Macs. Also a compile switch exists, which turns the Unix engine into a Windows line-break (CRLF, "\r\n") detecting engine. But not a flexible one: switching between engines by runtime option. So I need to enhance the engine to be able to handle different kinds of Line Endings.
Hope I found all related code branches to handle this correctly.

_Limitations_:

  1. The document should have consistent line-breaks: only CR or only LF or only CRLF.
  2. The engine is not configured to detect other (than LF, CR, CRLF) Unicode line-break code points.

This looks like a very useful addition, thanks for investigating @RaiKoHoff.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hpwamr picture hpwamr  路  4Comments

omega32 picture omega32  路  3Comments

hpwamr picture hpwamr  路  3Comments

blackcrack picture blackcrack  路  3Comments

zb-z picture zb-z  路  3Comments