Help! moving last 4 digits suffix

A swapping-ground for Regular Expression syntax

Help! moving last 4 digits suffix

Postby drlamer » Mon Sep 30, 2013 12:28 pm

here is an example.

From: FILENAME.EXT1234
To: FILENAME1234.EXT

Thanks!
drlamer
 
Posts: 2
Joined: Mon Sep 30, 2013 12:12 pm

Move last 4 digits in .extension to precede extension

Postby truth » Mon Sep 30, 2013 11:50 pm

This only renames files with exactly 7 chars in extension (keeps 1st-3, moves last-4 to precede extension)
Options / Ignore / FileExtensions=Checked
1Regex:
(.*)(\....)(....)$
\1\3\2
truth
 
Posts: 104
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionBelt, MilkyWay

Re: Help! moving last 4 digits suffix

Postby drlamer » Tue Oct 01, 2013 1:59 pm

truth - You're da man!!
drlamer
 
Posts: 2
Joined: Mon Sep 30, 2013 12:12 pm

Move last 4 digits in .extension to precede extension

Postby truth » Wed Oct 02, 2013 5:02 am

Not so much, just realized it fails with multiple periods (when the 1st-one is 7chars from $End):
Filen.ame.txt --> Filen.txt.ame

If thats an issue, use the below instead, it wont match anymore .'s after the . 7chars from $End
(.*)(\.[^.]{3})([^.]{4})$
\1\3\2
truth
 
Posts: 104
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionBelt, MilkyWay


Return to Regular Expressions