Regex Content searching

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Phlashman
Posts: 41
Joined: Sun Sep 11, 2022 4:57 am

Regex Content searching

Post by Phlashman »

Using Version 1.5.0.1337a (x64) Portable

Using the search string below to search in folder H:\Psim for files with text content "PUT ", I got a whole list of files...good so far.

"H:\Psim\" content:"PUT "

But I realised that it was picking up files with the string ..."put "... including "input ". I was after files that had lines begining with "PUT "
So first I tried regex:content:"PUT " and that returned the same files as the search above.

So I next tried regex:content:"^PUT " and this returned NO files (there are files that have lines begining with "PUT ") :(

I saw an earlier post from Void indicating this should have worked. Where have I gone wrong?
void
Developer
Posts: 16897
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex Content searching

Post by void »

Please try with the multi-line: search modifier:

multiline:regex:content:"^PUT "

-or-

regex:content:"(?m)^PUT "

Otherwise, regex will treat ^ as the start of the whole content instead of the start of the line.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Regex Content searching

Post by NotNull »

Without the regex-requirement, this should work too:

Code: Select all

each-line:startwith:content:"PUT "
each-line:
startwith:
adamantine
Posts: 214
Joined: Mon Jan 09, 2012 10:56 am

Re: Regex Content searching

Post by adamantine »

i try to use this line:
G:\my-folder\      regex:content:"*my-search*[*"

...in order to find the cue-files that contain the following (in some line):
- some symbols (or nothing)
- my-search
- some symbols (or nothing)
- [
- some symbols (or nothing)

in main menu of ET: reg-ex is not enabled (as always)

my cue/txt-files are indexed by ET

how should i correct the line? (so that it began working)
adamantine
Posts: 214
Joined: Mon Jan 09, 2012 10:56 am

Re: Regex Content searching

Post by adamantine »

the next variants do not work too:

"G:\my-folder\"      regex:content:"*my-search*[*"

"G:\my-folder\"     multiline:regex:content:"*my-search*[*"

"G:\my-folder\"     regex:content:"my-search*["

 
 
the next (partial) variant works:
G:\my-folder\       regex:content:"my-search*"
but it's obviously that it only finds the my-search part (10 lines appear in result-list),

if i remove the regex: symbols,   and enable the reg-ex (in main menu),    then ET loses those 10 lines,

if i add the [ part,    then the result-list is still empty
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: Regex Content searching

Post by ovg »

2adamantine

You have to escape [ with \:

Code: Select all

*my-search*\[*
adamantine
Posts: 214
Joined: Mon Jan 09, 2012 10:56 am

Re: Regex Content searching

Post by adamantine »

You have to escape [ with \:
there's no good result at the moment. i tried:

 
G:\my-folder\       regex:content:"*my-search*\[*"

"G:\my-folder\"      regex:content:"*my-search*\[*"

G:\my-folder\       regex:content:"my-search*\["

"G:\my-folder\"      regex:content:"my-search*\["

G:\my-folder\       content:"*my-search*\[*"                 (with enabled reg-ex in main menu)

"G:\my-folder\"      content:"*my-search*\[*"                 (with enabled reg-ex in main menu)

"G:\my-folder\"      regex:content:"*my-search*\\[*"

- to toggle the 'allow literal operators' (in options)
- to toggle the 'replace forward slashes with back-slashes' (in options)
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: Regex Content searching

Post by ovg »

Also replace * with .*

Code: Select all

regex:content:".*my-search.*\[.*"
adamantine
Posts: 214
Joined: Mon Jan 09, 2012 10:56 am

Re: Regex Content searching

Post by adamantine »

Also replace * with .*
thanks, it finally works:

Code: Select all

G:\PO\A\Ace Of Base      regex:content:"Don't Go Away.*\["
 
but it refuses to do the same if i remove the regex: part,
and enable the reg-ex in main menu

but the regex: part is seemingly less convenient (than ticking the main menu item)

 
added several minutes later:
the issue related to the 'reg-ex' main menu item
forced me to create a nice work-around/bookmark:

Code: Select all

G:\PO\A\×      regex:content:"×.*\["
- this bookmark is expected to be very helpful in the future

- nowhere (in my cue/txt-files) i have the × symbol,
so it's just a great object to be substituted for some other symbols
Post Reply