Regular Expressions

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Regular Expressions

Post by ErikJan »

I need to rename some files. Found some tools that can help me but in the end it seems I need to have to revert to regular expressions to do the job... In essence, it shouldn't be complex... this is what I have:

1983 France Some text xx.tif (where 'Some text' could be zero one or more words and 'xx' is a number, e.g. 01, 02).

I found that (of course...) this now doesn't sort so nice anymore (yeah, stupid, I should have thought this out first)... So what I want is this:

1983 France xx Some text.tif

So in essence, the 2-digit number at the end should move after the fixed lead text (here '1983 France').

Any experts out there?

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Regular Expressions

Post by ErikJan »

Got it! (for the specific renamer I use)

(^1983 France )(\w*) (\d{2})

Replace by: $1$3 $2