Unable to show regular expression match

Discussion related to "Everything" 1.5.
Post Reply
abtxu
Posts: 4
Joined: Mon Jul 28, 2025 1:26 pm

Unable to show regular expression match

Post by abtxu »

I have modeled my command from this post:

Display file "content:" search results - like grep
viewtopic.php?t=11060

My search command:

Code: Select all

D:\HOME\org\notes\ ext:txt regex:content:"pandoc" addcolumn:regmatch1
While Everything correctly picked up the file containing the search word "pandoc", it will not be able to display search match.
image.png
image.png (26.18 KiB) Viewed 2781 times
I am using Version 1.5.0.1396a (x64) on Windows 10. Any help will be appreciated. Thanks in advance.
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: Unable to show regular expression match

Post by void »

Please use ( and ) to capture text:

Code: Select all

D:\HOME\org\notes\ ext:txt regex:content:(.*pandoc.*) addcolumn:regmatch1
The line containing pandoc is shown under the regmatch1 column.
The first ( ) group will capture the match into regmatch1.
The second ( ) group will capture the match into regmatch2.
and so on..



regmatch0 shows the whole match. (not the whole contents of the file, it will just be pandoc)
However, in this case, nothing is shown for Regular expression match 0 because of an optimization.
To use Regular expression match 0, prefix your regex search with nofastregex:

Code: Select all

D:\HOME\org\notes\ ext:txt nofastregex:regex:content:"pandoc" addcolumn:regmatch0
Please note, regmatch0 shows only the matched text.
In this case it will just be pandoc.

I will disable regex optimization when the Regular expression match 0 column is shown in the next alpha update.
abtxu
Posts: 4
Joined: Mon Jul 28, 2025 1:26 pm

Re: Unable to show regular expression match

Post by abtxu »

Hi Void,

It works! Thanks so much! I have made it into a customized search command which is very handy to use.

A quick follow up: how to show all the matches?

In a file with multiple matches, it seems that only the first one will show up on the regular expression match 1, and the rest will not be visible. Also, the matches in the preview are not highlighted.
image.png
image.png (50.73 KiB) Viewed 2732 times
But I can see that in this post, the matches are highlighted:
viewtopic.php?t=11060
Attachments
image.png
image.png (40.68 KiB) Viewed 2732 times
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: Unable to show regular expression match

Post by void »

A quick follow up: how to show all the matches?
It's not really possible.

It can be done, but it's not really practical to type:

Code: Select all

D:\HOME\org\notes\ ext:txt <regex:content:(.*pandoc.*)[\S\s]*?(.*pandoc.*)[\S\s]*?(.*pandoc.*) | regex:content:(.*pandoc.*)[\S\s]*?(.*pandoc.*) | regex:content:(.*pandoc.*)> add-column:regmatches

But I can see that in this post, the matches are highlighted:
Everything doesn't highlight text in previews.
This is on my TODO list.
In this case the user has manually highlighted the text.
Post Reply