stefankueng / grepWin

A powerful and fast search tool using regular expressions
https://tools.stefankueng.com/grepWin.html
GNU General Public License v3.0
1.74k stars 180 forks source link

Indicate invalid regex in 'File names match' and 'Exclude dirs' #424

Closed MartinRJ closed 1 year ago

MartinRJ commented 1 year ago

The "File Names match" options (Regex match/Text match) are not working as expected.

How to reproduce:

Actual result: Search results are empty.

Actual result: Search finds "doc3.txt" image

If you switch to "Text match", the regex will be applied properly, but it also works if I set the "File Names match" to Text match and search for "doc.txt". So it appears, there were some underlying changes made, that make the "Text match" accept both: regex and non-regex searches, but the UI doesn't reflect that, and the Regex match setting appears broken, and the Text match is not working as expected. When I search for Text match (non-regex, that is) with .txt, I don't necessarily expect it to find file names that are different to literally ".txt", when there's an explicit distinction between regex match and text match.

There's another bug, that may be related:

Actual result: The search results list doesn't repopulate.

Version: 2.0.15.1232 (I also tested version 2.0.10, which has the same bug)

stefankueng commented 1 year ago

*.txt is NOT a valid regex! The equivalent of *.txt in regex would be something like .*\.txt The 'text match' option for file names matching is not just 'text' match but uses the common globs like * and ? to match the filenames. 'Regex match' however uses the regex engine to match the filenames.

MartinRJ commented 1 year ago

You're right, I'm sorry for the oversight. I'll do some more testing and close the issue, if it works as expected.

MartinRJ commented 1 year ago

I can confirm that part #1 of the report actually works as intended, furthermore as for part #2 of my report, it appears the missing repopulation of the list stems from the wrong regular expression. It would help if there was some kind of warning in the UI, instead of the app just doing 'nothing'.

My confusion came from the tooltip text ("Example: *.cpp|*.h"), which doesn't change when you switch to "Regex match". So I assumed that these "common globs" work in the regex mode.

stefankueng commented 1 year ago

changing issue to somehow indicate when a regex is invalid