Regex to modify filename/s for a UDC or catalog catagory?

Discuss and share scripts and script files...
Post Reply
BobCrash
Posts: 33
Joined: 15 Sep 2017 03:17

Regex to modify filename/s for a UDC or catalog catagory?

Post by BobCrash »

Hi All..

fname ex: ExampleOfWhatI'llBeWorkingWithPlusMaybeNASAForWishList.xxx

output: Example Of What I'll Be Working With Plus Maybe NASA For Wish List.xxx

1 maybe place in my rag-tag UDC collection..
2 would like to start a 'category' of 'single' rename picks of most used 'cleanups' for custom catalog..
..not sure how to refer it properly for that, but wish is list showing like next 'Tbar' example,
with final result of catalog list is that it stays open and active while I correct a bunch of files..

3 could I drop it into a list of cleanups I have on a Tbar 'cleanup' button script?, perhaps like:
-
"'Uppercase' First Letters" #126;
"Replace '-' with spaces" rename "s", "-/ ", "";
"Replace '.' with spaces" rename "s", "./ ", "";
"Replace '-' with ' - '" rename "s", "-/ - ", "";
-
"Separate TitleCase filenames" rename "r" .... <------- ??

Hope it's clear enough..
The reason for multiple calling wish's is I'm playing with the various 'productivity' methods..
I've been 'cut-and-pasting' bits & pieces from various contributors here for a long time..
so I'm not fluent with scripting, just an amatuer hacker.. but a huge fan of all the gang...
If I am going in a wrong direction, please bump me towards the path! ..Thanks in advance!

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Regex to modify filename/s for a UDC or catalog catagory?

Post by highend »

This isn't just a single regex, special cases like a leading uppercase char or abbreviations like NASA would require
more effort...

Code: Select all

([A-Z]+) >  $1\

Code: Select all

 Example Of What I'll Be Working With Plus Maybe NASAFor Wish List.xxx
One of my scripts helped you out? Please donate via Paypal

BobCrash
Posts: 33
Joined: 15 Sep 2017 03:17

Re: Regex to modify filename/s for a UDC or catalog catagory?

Post by BobCrash »

thanks for quick reply..
This isn't just a single regex, special cases like a leading uppercase char or abbreviations like NASA would require
more effort..
That's ok.. I thought it might be some looping monster just for that extended NASA 'wish'...

Your 'simple' shotgun version however, works great, and best part is, I can handle it's simplicity !

Thanks Highend for a piece of your valuable time!

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Regex to modify filename/s for a UDC or catalog catagory?

Post by highend »

Just make sure that you remove the leading space in this new file name afterwards :oops:
One of my scripts helped you out? Please donate via Paypal

BobCrash
Posts: 33
Joined: 15 Sep 2017 03:17

Re: Regex to modify filename/s for a UDC or catalog catagory?

Post by BobCrash »

Highend, your reputation is still intact here, your little code snippet works perfectly on all my file probs - single/multi file picks, w/wo leading Cap, w/wo preview... I could not make it burp... Never a leading space...

Code: Select all

"Separate TitleCase filenames 'PView'" rename "r", "([A-Z]+) >  $1\", "p";
"Separate TitleCase filenames" rename "r", "([A-Z]+) >  $1\", "";
Used the above test lines inside a toolbar button script I have hacked together over time...

Very Cool. Thank you, sir ..what great help this was! :appl:

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Regex to modify filename/s for a UDC or catalog catagory?

Post by highend »

Ok, XY removes the leading space automatically.

You would notice it's existence if you'd use a regexreplace() in a script...
One of my scripts helped you out? Please donate via Paypal

Post Reply