Search for File names in all capital letters/upper case

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Search for File names in all capital letters/upper case

Post by *jinsight »

Any ideas how to search for file names that are in all caps? Any help appreciated.
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

jinsight,

Code: Select all

(?-i)^[A-Z]+$
[x] RegEx

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Post by *jinsight »

Using (?-i)^[A-Z]+$ in a subfolder off of the root with files and multiple subfolders, a few all cap folders and files were found but many were missed.

TC 8.52a 64 bit on Win7 Enterprise SP1
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

jinsight,
Maybe they contained numbers and other characters in addition to all caps?
Adjust [A-Z] as appropriate, eg.:

Code: Select all

[A-Z0-9!@#$%^&()]
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

To ignore the extension and only discard non caps:

Code: Select all

(?-i)^[^a-z]+\.*[^.]*$
Edit: Include files with no extension
Last edited by ZoSTeR on 2016-03-28, 20:40 UTC, edited 2 times in total.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

ZoSTeR,
Ah, much better, excluding lowercase, stupid me.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Hmm... but how to exclude "ABCdef" with no extension?
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

ZoSTeR wrote:(?-i)^[^a-z]+\.*[^.]*$
Hmm... but how to exclude "ABCdef" with no extension?
This would work, and I think it's easier to read, due to the "0 or 1" quantifier:

Code: Select all

(?-i)^[^a-z]+(\..+)?$
2jinsight and others:
In case you didn't know:
For a quick test, w/o using the search (Alt+F7), just use the "Mark files" dialog (Numpad+)
and prefix "<"

e.g.

Code: Select all

<(?-i)^[^a-z]+(\..+)?$
or just save this RegEx as a search preset (important to remove the search path for this) and select this preset afterwards in the "Mark files" dialog.
TC plugins: PCREsearch and RegXtract
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

This fits all my test cases:

Code: Select all

(?-i)^[^a-z]+(\.[^\.]+)?$
For:

Code: Select all

abc.txt
abc.xyz.txt
abc123.txt
aBCD
BCD
BCD.txt
BCD.aYZ.txt
BCD.XYZ.txt
BCD123
BCD123.txt
BCDabc
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

ZoSTeR wrote:This fits all my test cases:

Code: Select all

(?-i)^[^a-z]+(\.[^\.]+)?$
I see, the only difference to my expression is that it doesn't match
BCD.aYZ.txt

Anyway, there are still cases when an all-digit file name is matched, e.g.:
123.txt
so we should stipulate at least one upper case letter:

Code: Select all

(?-i)^([^a-z]*[A-Z][^a-z]*)+(\.[^\.]+)?$
TC plugins: PCREsearch and RegXtract
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Post by *jinsight »

All posters,

Thanks for all the effort everyone put in to find a useful answer.

I had searched the web but found nothing close.

(?-i)^([^a-z]*[A-Z][^a-z]*)+(\.[^\.]+)?$ worked the best for me.

It saved a lot of time finding old all caps file names.

Much appreciation to all.
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
Post Reply