Hi, @coises and All,
You said :
The practical effect of that is that the default engine [ of rg.exe ] doesn’t support lookarounds or backreferences …
Well, actually, if you choose the --pcre2 option, it does support them ! For example :
The rg -a -t txt --stats Fi(?=le) DOS command returns :
C:\>d:
D:\>rg -a -t txt --stats Fi(?=le)
rg: regex parse error:
(?:Fi(?=le))
^^^
error: look-around, including look-ahead and look-behind, is not supported
Consider enabling PCRE2 with the --pcre2 flag, which can handle backreferences
and look-around.
D:\>
And, indeed, the command rg -a -t txt --stats --pcre2 Fi(?=le), after a restart, is quite functional and give these results :
2250 matches
1596 matched lines
104 files contained matches
642 files searched
271490 bytes printed
88413019 bytes searched
130.606157 seconds spent searching
17.113812 seconds total
Note that I do not understand why the total search took about 17 s and the search, itself, took about 130 s ? But this is an off-topic question !
Then, the next step, to my mind, was to try, for example, the regexes :
(?=[[=O=]])\X(?=[[=u=]])\X(?=[[=r=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=r=]])\X(?=[[=i=]])\X(?=[[=e=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=S=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=s=]])\X
(?=[[=O=]])\X(?=[[=u=]])\X(?=[[=r=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=r=]])\X(?=[[=i=]])\X(?=[[=e=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=Š=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=ū=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=s=]])\X
(?=[[=O=]])\X(?=[[=u=]])\X(?=[[=r=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=r=]])\X(?=[[=i=]])\X(?=[[=e=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=S=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=s=]])\X
Our friend Sarunas
Our friend Šarūnas
Our friend Šarūnas
And verify if EACH of these three regexes did match the three lines beginning with Our friend ..., right below !
Alas, thrice alas ! The program returns the message :
D:\>rg --stats --pcre2 (?=[[=O=]])\X(?=[[=u=]])\X(?=[[=r=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=r=]])\X(?=[[=i=]])\X(?=[[=e=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=Š=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=ū=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=s=]])\X Coises.txt
rg: PCRE2: error compiling pattern at offset 12: POSIX collating elements are not supported
D:\>
Even this simple command, below, fails :
D:\>rg --stats --pcre2 [[=q=]] Coises.txt
rg: PCRE2: error compiling pattern at offset 9: POSIX collating elements are not supported
D:\>
You can verify this assumption, at the end of this page : https://www.regular-expressions.info/refcharclass.html
Now, you said :
I’m curious whether you, or anyone, foresees practical cases in which you would want to omit one from a search but not the other.
Well, I do not need that distinction for myself ! It’s just that your excellent Search in Files dialog can already filter :
By folder
And /or by included extensions or excluded extensions or *regex
And/or by size
And/or by date-type and date
Thus, it seemed to me that you could also add these two separate options Hiden files and Hidden folders, in order that this dialog was even more flexible ! But, of course, do as you like ;-)
Best Regards,
guy038