Regex \r\n replace broken

Byzod
2012-11-03
2012-11-28
  • Byzod
    Byzod
    2012-11-03

    Win7 x64 pure npp6.2 without anything

    The gif says all

     
  • Byzod
    Byzod
    2012-11-03

    BTW, replace backreference do not support group number larger than 9
    Can we support \g{n} syntax or named group backreference? So we can do things like this:

    Search : (?<TheID>\d+)-(?<TheName>\w+)-(?<TheRest>\w+)
    Replace with:  Your ID : \k<TheID>,  Your name : \k<TheName>, Things That I can't understand : \k<TheRest>

    It's better readable!

     
  • Loreia2
    Loreia2
    2012-11-03

    Hi byzod,

    The \r\n thing works just fine for me.
    Try to disable plugins folder and try again. It should work.

    About the second thing (named back-references), I think boost RE library does support them. Please check in boost online documentation.

    Thank you and best regards
    Loreia

     
  • Byzod
    Byzod
    2012-11-04

    Hi loreia2, thanks for your test.
    But if you have time, please try again with the FULLY repeat steps again:

    1. Download npp6.2 form http://download.tuxfamily.org/notepadplus/6.2/npp.6.2.bin.zip.
    2. Unzip it to the folder you like. No need to modify any file.
    3. Open it up, check View > Show Symbol > Show all characters (optional step, just for better observation)
    4. Type 4 line with anything, make sure you see some CR LF
    5. Press ctrl+F or click menu item Search > Find
    6. Switch to replace tab, check Search mode > Regular expression
    7. Type

    \r\n
    

    in FInd What text area, type anything in Replace With text area.
    8. Click Replace

    Expect result: CR LF replace with what you just typed.

    Result: Nothing happend.

    More info:
    Very wierd, it WORKS with the replace all or replace all in all opened document button.
    It WORKS with the Search mode > Extended mode, too.

     
  • Byzod
    Byzod
    2012-11-04

    And sorry for all the typo

     
  • Loreia2
    Loreia2
    2012-11-04

    Hi byzod,

    yes, I see it now. Replace all works, but Replace (one by one) fails to do anything.
    There was a similar bug when user tried to remove white space from beginning of line.

    Dave Brotherstone is notified about it, so it will be fixed when he finds time to do it.

    BR
    Loreia

     
  • Byzod
    Byzod
    2012-11-04

    Thank you for your reply and testing Loreia, glad to bury one more bug

     
  • Byzod
    Byzod
    2012-11-15

    Another problem, even replace all is broken too:
    Broken replace all

    As what you can see in this animation picture, replace all is actually "replace some" on the newest npp 6.2.1. Besides, replace is still not working.

     
  • Byzod
    Byzod
    2012-11-23

    ANOTHER bug
    Text to modify: abc
    Regex: a(?=b)
    Replace with: A

    Click Replace, nothing happend, result: abc
    Click Replace all, result is Abc

    Looks like there's something wrong with the replace & replace all function.
    Reproduce steps similar to the 3rd post

     
    Last edit: Byzod 2012-11-23
  • Loreia2
    Loreia2
    2012-11-23

    Hi Byzod,

    perhaps it would be the best to contact Dave (author of RE feature) directly.
    You can find his e-mail on his github page: https://github.com/davegb3

    Regards,
    Loreia

     
  • Just to chime in here - I am aware of this, and I'm looking into it. I don't think it's got too much to do with the new regex engine, rather the old search and replace code. I'll post a patch as soon as I've got something I'm happy with. (At the moment, a "gaffer tape" solution would be, I think, quite easy, but that's not really what I'm after!)

    Cheers,
    Dave.

     
  • Byzod
    Byzod
    2012-11-25

    @Loreia2 Thanks for the email address, however Dave himself is here and now :)

    @Dave So, the Find and Replace engine are separated? That explains what I were encountered: I can find anything I want using the new and powerful Regex engine, but cannot replace them correctly.
    Waiting for you new code! Thanks for your hard-working, all of you.

    Sincerely and patiently,
    Byzod.

     
  • Glyph
    Glyph
    2012-11-27

    Additionally the "In Selection" checkbox doesn't work correctly.

    If this box is checked, "Replace All" works fine, but "Find Next" also finds text outside of the selection.

     
  • I've posted a patch to on the tracker - https://sourceforge.net/p/notepad-plus/patches/437/

    This is the gaffer tape solution. The real solution is going to take quite a bit longer - the replace code needs a serious tidy up.

    I've posted the binary to https://github.com/davegb3/npp/downloads - any testing would be appreciated. Although I'm pretty sure this isn't the only bug lying in there, - as I said, it needs a clean up, and I'm not sure how long that's gonna take.

    Cheers,
    Dave.

     
  • Byzod
    Byzod
    2012-11-28

    Hi Dave

    Knowing that you are trying to kill those bugs is enough for me. Thank you again.