Two more examples of Bridge renaming using Regular Expressions…

1. Use brackets around your RegEx search in Find to set a group which can be backreferenced in Replace:

Here I’m wanting to replace any 3 characters that appear in between “foo-” and “-bar” with “newstring”…

Current name:
foo-tla-bar.jpg

Find:
(foo-)(.{3})(-bar)

Replace:
$1newstring$3

Result:
foo-newstring-bar.jpg


2. find “yyyy-mm-“:

^[0-9]{4}-[0-1][0-9]-


3. Split file name at a marker (remove all characters before a set unique/special character)

Example – have to supply images to devs named only by numerical ID (don’t ask) but want to keep a descriptive name on the PSD.

So named the PSD something like this: “My-nice-name#12345.psd” – need to deliver “12345.jpg”.

NB this only works if the separating character (#) that splits the two parts of the name only ever appears as the separator.

Saved for web as “My-nice-name#12345.jpg” then run through Bridge renaming with the following RegEx setup:

Find:
(.*)#(.*)

Replace:
$2

BridgeRegEx3


4. replace the undersorces with hyphens in “jkjkjkjkj_aa_jkjkjkjk”:

batch


See also cheatography.com

Last Updated on