Where to report Regex bug?



  • Sorry if this is the wrong area.

    Running v7.7.1 (32bit) with build time of Jun 16 2019 - 21:14:50 and I always accept updates when prompted.

    I have a TXT file that is 2280 lines long consisting of a header ‘ANNUAL_SALARY’ followed by 2278 lines of 0000000000 followed by a return, so line 2280 is null

    (sample file… line of 0’s repeats… last line is empty)
    ANNUAL_SALARY
    0000000000

    Only Regular Expression and Wrap Around are selected on “Replace” tab.
    When Find = (\d|\r|\n)* and Replace = null the result is ANNUAL_SALAR without the trailing Y

    If I delete one of the 0000000000 lines and run the replace the result is ANNUAL_SALARY with the Y.

    This was the simplest test case I could come up with.

    Thanks for the great product!!!

    David



  • @David-Caylor said:

    Sorry if this is the wrong area

    It is. The official bug reporting area may be found via this link: https://notepad-plus-plus.org/community/topic/15741/faq-desk-feature-request-or-bug-report

    But of course it is ok to discuss suspected bugs here first.

    I think you might be a victim of a “catastrophic” regular expression situation.

    Try this, which may (or may not) be equivalent to the Replace All operation you’ve described, but for purposes of illustration it might be valid: Without changing anything else about your setup, change to the Mark tab of the Find window, then press Mark All. Notice that all of your text will be marked with a red background (indicating what matched), including ANNUAL_SALARY, which sanity says your regular expression should not match.

    Now have a look here: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4761 and do some reading…

    What it comes down to is that you should write a better regular expression to match your data. Perhaps \d+\R as a suggestion for your Replace All operation. Maybe I would do something different from that, but I don’t know what you are really trying to accomplish; I think your example is just that, an example, and your real task is hidden from us – that’s okay, not a problem.

    BTW, your regular expression is inefficient and/or “odd” in other ways. Would it surprise you to know that it will match the zero-length positions between every character in ANNUAL_SALARY? We offer some learning advice about regular expressions here: https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation


Log in to reply