Using Regex in the Find Files box

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Using Regex in the Find Files box

Post by *Andante »

How can I specify a reverse search in the "Search for" field?

That is, I'd like to find all files that do NOT begin with a P.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Using Regex in the Find Files box

Post by *Dalai »

Search for:

Code: Select all

^[^P]
[X] RegEx

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Re: Using Regex in the Find Files box

Post by *Andante »

Wonderful, Dalai, thanks. It worked like a charm.

Can you explain what the ^ and the [ ] indicate?
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Using Regex in the Find Files box

Post by *petermad »

You could also just use this in the "Search for:" field (without RegEx):

Code: Select all

*|P*
Meaning: look for all files (*), but not (|), files that start with a P (P*)


^[^P] means: in the start (^), look for a character ([]), which is not P (^P)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Re: Using Regex in the Find Files box

Post by *Andante »

Thanks, Peter, that's even better. I was hoping to specify a particular type of extension, and this enables me to do so.

So in the future, I can use a vertical bar to specify "not"?
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Using Regex in the Find Files box

Post by *Dalai »

Andante wrote: 2019-09-03, 21:01 UTCSo in the future, I can use a vertical bar to specify "not"?
Yes. This is also mentioned in the TC help, in the topic "Find files".

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply