Page 1 of 1

Regex Content searching

Posted: Mon Feb 13, 2023 5:42 am
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?

Re: Regex Content searching

Posted: Mon Feb 13, 2023 5:53 am
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.

Re: Regex Content searching

Posted: Mon Feb 13, 2023 7:46 am
by NotNull
Without the regex-requirement, this should work too:

Code: Select all

each-line:startwith:content:"PUT "
each-line:
startwith:

Re: Regex Content searching

Posted: Sat Mar 18, 2023 5:42 am
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)

Re: Regex Content searching

Posted: Sat Mar 18, 2023 5:53 pm
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

Re: Regex Content searching

Posted: Sat Mar 18, 2023 6:40 pm
by ovg
2adamantine

You have to escape [ with \:

Code: Select all

*my-search*\[*

Re: Regex Content searching

Posted: Sat Mar 18, 2023 8:37 pm
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)

Re: Regex Content searching

Posted: Sat Mar 18, 2023 9:37 pm
by ovg
Also replace * with .*

Code: Select all

regex:content:".*my-search.*\[.*"

Re: Regex Content searching

Posted: Sat Mar 18, 2023 10:28 pm
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