Community
    • Login

    Where to report Regex bug?

    Scheduled Pinned Locked Moved General Discussion
    bug mayberegex
    2 Posts 2 Posters 3.8k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • David CaylorD Offline
      David Caylor
      last edited by

      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

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @David Caylor
        last edited by

        @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

        1 Reply Last reply Reply Quote 2

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors