Special Replace all problem with UltraEdit regular expression with caret on a line to remove at a certain position

Special Replace all problem with UltraEdit regular expression with caret on a line to remove at a certain position

1581
Power UserPower User
1581

    Nov 08, 2019#1

    Please try to reproduce.
    Challenge: "replace all lines which contain 'lorem ipsum'"

    Take a text with similar and non similar lines:

    Code: Select all

    test test
    abc lorem ipsum hello
    xxx
    123 lorem ipsum xx
    123 lorem ipsum 456xx
    123 lorem ipsum 789xx
    123 lorem ipsum 999xx
    yy
    456 lorem ipsum yy
    zz
    789 lorem ipsum zz
    bla bla
    Search for: ^p*lorem ipsum*^p
    Replace with: ^p
    Regular expression: yes
    Regular expression engine: UltraEdit
    Replace all is from top of file: yes

    Place your cursor to a line in a "similar block", but not in the first line, e.g. in line with 999xx.

    Press "replace all" again and again.
    -->> result: The line with the caret will not be replaced.

    Screencast: https://autode.sk/36JIAPR

    Seem to be a strange random error:
    • Works fine when the cursor is anywhere.
    • Works fine when the cursor is in first line of the similar block.
    • Works fine with "Replace" (single).
    UE 26.20.0.74 German / Win 10 x 64 Pro

    6,602548
    Grand MasterGrand Master
    6,602548

      Nov 09, 2019#2

      I could reproduce this issue with UltraEdit for Windows v26.20.0.46, v22.20.0.49, v11.20b and v10.10c which is the oldest version still archived by me.

      Peter, congratulations, you found an UltraEdit regular expression bug existing in all versions of UltraEdit for Windows.

      The line with the caret is not removed by the UltraEdit regular expression Replace all on caret being positioned on a line to remove after fixed string lorem ipsum and end of line, i.e. the part of the line matched by * right to second ^p in the UltraEdit regular expression search string. It does not matter on which line containing lorem ipsum the caret is positioned if being set after lorem ipsum.

      I knew from the past as I wrote lots of macros using UltraEdit regular expression finds and replaces and which are still used by me with currently latest UltraEdit that the sequences ^p* and ^p?++ result often in unexpected find/replace behavior and learned to avoid these regular expression sequences.

      The simple workaround for this bug is using as search string %*lorem ipsum*^p and an empty replace string which removes with just one Replace all all lines containing lorem ipsum and being terminated with carriage return and line-feed independent on where the caret is positioned on having enabled replace option Replace all is from top of file.

      It is up to you if you want to report this special UltraEdit regular expression replace all issue to IDM support by email. But I doubt that an UltraEdit developer will ever look on it although easy reproducible because of the UltraEdit regular expression engine is legacy since more than 10 years.
      Best regards from an UC/UE/UES for Windows user from Austria

      1581
      Power UserPower User
      1581

        Nov 11, 2019#3

        Thanks Mofi

        I just reported it to IDM. Let's see ..

        For me very important is your hint with "using as search string %*lorem ipsum*^p. I just missed this possibility and I will use it now ...

        Peter
        UE 26.20.0.74 German / Win 10 x 64 Pro