Regex in select, colors, sort ...

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
krojc
Junior Member
Junior Member
Posts: 71
Joined: 2003-08-20, 08:46 UTC

Regex in select, colors, sort ...

Post by *krojc »

For some reason, I can not (or am doing it wrong) use regex in select files, color by filetype and similar. It says that I should put regex after the <.

What I want is to select, find, color any file that is not small letters, numbers and underscore.

I do: <^[a-z0-9_], but all files get selected.
What am I doing wrong.

Thanks,
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Re: Regex in select, colors, sort ...

Post by *milo1012 »

krojc wrote:What I want is to select, find, color any file that is not small letters, numbers and underscore.

I do: <^[a-z0-9_], but all files get selected.
You need to negate the character group and enable case sensitivity:

Code: Select all

<(?-i)^[^a-z0-9_]
But this would only select files not having such a character at the first position.
What exactly are you looking for? Names with any uppercase characters at any place, or just the first position?

Just remove the caret if you're looking for filenames having anything but lower case letters, digits and underscore at any place.
But you'd also need to consider the extension dot (period) in that case:

Code: Select all

<(?-i)[^a-z0-9_.]
TC plugins: PCREsearch and RegXtract
krojc
Junior Member
Junior Member
Posts: 71
Joined: 2003-08-20, 08:46 UTC

Post by *krojc »

That is exactly it!
I expected a-z to be enough to make it case sensitive.

Thanks, you made my day!
krojc
Junior Member
Junior Member
Posts: 71
Joined: 2003-08-20, 08:46 UTC

Post by *krojc »

To extend this great regex selecting ...
Is it somehow possible, to sort "selected".

What I do is, use CTRL+B bo show all the files in all the subdirs, then regex select. I get a few selected among thousands, but then need to scroll for them.

Thanks
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

You could use Ctrl+S to only show selected files or use cm_GotoNextSelected with a hotkey.
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

ZoSTeR wrote:You could use Ctrl+S to only show selected files or use cm_GotoNextSelected with a hotkey.
Why so complicated?
Wouldn't cm_ShowOnlySelected be enough for that purpose?

It's one of the many commands where I miss accessibility in the default installation.

So you either need to:
create a new button in the button bar,
modifying the Main menu (.mnu files) or using the already available extended menus,
or create a keyboard shortcut (Configuration -> Misc. -> Redefine hotkeys)

(I mapped cm_ShowOnlySelected to Ctrl+Shift+F10)
Last edited by milo1012 on 2015-07-31, 09:07 UTC, edited 1 time in total.
TC plugins: PCREsearch and RegXtract
krojc
Junior Member
Junior Member
Posts: 71
Joined: 2003-08-20, 08:46 UTC

Post by *krojc »

How do I use CTRL+S to show only selected. It doesn't seem to work!?
User avatar
Dalai
Power Member
Power Member
Posts: 10035
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2milo1012
The command cm_ShowOnlySelected is already in the stock/default menu: Show > Only Selected Files. So there's no need to modify the main menu.

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
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

Dalai wrote:The command cm_ShowOnlySelected is already in the stock/default menu: Show > Only Selected Files. So there's no need to modify the main menu.
I'm quite aware of that ;)
But a more prominent position is sometimes favorable.

Petermad's Extended Menus group such commands a lot better IMO.
TC plugins: PCREsearch and RegXtract
krojc
Junior Member
Junior Member
Posts: 71
Joined: 2003-08-20, 08:46 UTC

Post by *krojc »

Uffff, thank you.
Till now I NEVER really saw the Show > Only Selected Files!
Yes, it works as expected.

When you pointed me to the Show menu, I found a direct one CTRL+F12, which already knows my regex from the beginig of this post. I can do it in one step.

Thank you!
Post Reply