Ticket #4526 (closed defect: fixed)

Opened 3 months ago

Last modified 3 months ago

Wrong string replacement using regular expression with $-sign (end of line)

Reported by: sabitov Owned by:
Priority: major Milestone: 4.8.32
Component: mcedit Version: 4.8.27
Keywords: Cc:
Blocked By: #4525 Blocking:
Branch state: no branch Votes for changeset:

Description

I suppose, this problem concerns a similar problem described in the ticket #4525

How to reproduce

1 Run mcedit and type in these lines:

111
112
113
114
115
121
122
<empty line here>

2 Go to the beginning of the file and press F4
3 Fill in the form this way:

"Enter search string:" .$
"Enter replacement string:" 7
(*) "Regular expression"

4 <OK> -> <All>

The correct result MUST be:

117
117
117
117
117
127
127
<empty line here>

As a result you'll get this text:

1177117711771177117712771277
<THERE IS NO! empty line here>

That's wrong

This regex has to change only the last char in each line. "Newline" symbols should be ignored.

a) The last chars are replaced in all lines. It's correct.
b) But all "newline" symbols are changed by "7" also. This isn't correct!

PS. It seems to me that the algorithm should ignore the symbols \r and \n always, except when the user specifies them explicitly.

Change History

comment:1 Changed 3 months ago by andrew_b

  • Version changed from version not selected to 4.8.27
  • Blocked By 4525 added
  • Milestone changed from Future Releases to 4.8.32

comment:2 Changed 3 months ago by andrew_b

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in #4525: [a58e0a1d6182beadec7d2db1f434082fb9744719].

git log --oneline c1832fd58..a58e0a1d6
Note: See TracTickets for help on using tickets.