Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-matching RegEx sometimes erroneously matches entire file #4569

Open
Piet-Kannitverstan opened this issue Jun 8, 2018 · 2 comments
Open

Comments

@Piet-Kannitverstan
Copy link

Description of the Issue

Regex that should not match anything sometimes matches the entire file. Seems to happen if a very long match (about 10000 characters) is followed by a mismatch.

Steps to Reproduce the Issue

  1. Create a line containing arbitrary text of length 14138 (seems to be a "magical" number); make sure that your text does NOT contain one certain character, e.g. an underscore "_"
  2. Search for RegEx ..*_ (any character, any number of any characters, underscore)
    => Nothing is found (which is the correct behaviour).
  3. Add one character to the long line (now length 14139).
  4. Search for the same Regex => ERROR: The entire text is found

More Information

  1. The number 14138 seems not to be a "constant"; it may differ slightly if the file contains additional lines. If you can't reproduce the error, simply add some more characters to the long line.
  2. Apparently, always the entire file (including newlines) is found if the error occurs, although the RegEx should not match newline characters.
  3. The RegEx above is just a simple example. In my case, the error occurred quite often with much more complicated RegEx's. The error pattern seems to be always the same: At least two subsequent "fuzzy" elements (in our example . and .*) produce a very long match, but at the end, there is a mismatch (in our case the missing underscore).
@Piet-Kannitverstan
Copy link
Author

Debug Information

Notepad++ 7.5.4 (32 bit) on windows 7

@sasumner
Copy link
Contributor

sasumner commented Jun 8, 2018

I can confirm this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants