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

Multi-line regular expression where no match exist for pattern part after long catch-all matches from start of match until end of file #8545

Open
vgriph opened this issue Jul 9, 2020 · 1 comment

Comments

@vgriph
Copy link

vgriph commented Jul 9, 2020

Description of the Issue

Doing a find using a regular expression with ". matches newline" enabled using a regular expression similar to:

(Start:).*^(\1 End pattern) 

where a match for (Start:) exists, but no match for ^(\1 End pattern) over a large file will match from (Start:) to the end of the file.

Steps to Reproduce the Issue

  1. Create a new text file with the following content:
    On a text file with contents similar to:
1>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P1)
1>FastUpToDate: ...
1>FastUpToDate: Project is up to date. (P1)
1>FastUpToDate: Up to date check completed in 10 ms (P2)
2>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P2)
2>FastUpToDate: ...
2>FastUpToDate: Input marker is newer than output marker, not up to date. (P2)
2>FastUpToDate: Up to date check completed in 49,1 ms (P2)
3>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P3)
3>FastUpToDate: ...
3>FastUpToDate: Project is up to date. (P3)
3>FastUpToDate: Up to date check completed in 14 ms (P3)

(or use npp-regex-bug.txt)

  1. Duplicate the line 2>FastUpToDate: ... so that it appears at least 2093 times in the file.
  2. Go to the start of the file and search for (\d+>FastUpToDate:).*^(\1 Project is up to date\.) using the "Regular expressions" and ". matches newline" options.
  3. Click "find next"

Expected Behavior

First hit is the lines

1>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P1)
1>FastUpToDate: ...
1>FastUpToDate: Project is up to date. 

Second hit is the lines

3>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P3)
3>FastUpToDate: ...
3>FastUpToDate: Project is up to date. 

Actual Behavior

First hit were the lines

1>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P1)
1>FastUpToDate: ...
1>FastUpToDate: Project is up to date. 

Second hit was from the line 2>FastUpToDate: Adding UpToDateCheckBuilt outputs: (P2) to the end of the file.

Debug Information

Notepad++ v7.8.7 (64-bit)
Build time : Jun 5 2020 - 02:38:56
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1803
OS Build : 17134.1553
Current ANSI codepage : 1252
Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll XMLTools.dll

@sasumner
Copy link
Contributor

sasumner commented Jul 9, 2020

Very likely another manifestation of #4761 -- catastrophic regex engine failure -- that is currently not detected and handled well in Notepad++.

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