#1 2014-08-08 11:35

ricm
Member
Registered: 2014-08-08
Posts: 2

Problems with renaming files starting with a sequence of numbers

Hi,

I have some filenames of the form:


136037-QP-2012-May-15-unit-a221-01-unit-01-b1-b2-b3-F

I have tried to use S&R with wildcards to relocate the numeric sequence at the beginning (which could be 4-8 numbers followed by dash) to the end to give:

QP-2012-May-15-unit-a221-01-unit-01-b1-b2-b3-F-136037

I have used many variations on the theme including:

"\A([\d]+)-(.+)" ==> "$2-$1"
and even:
"(\A[\d]+)-(.+)" ==> "$2-$1"
and
"^([\d]+-(.+)" ==> "$2-$1"

Nothing ever gets replaced.

Even the simple form given in this forum "\A[\d\-\.\s]+(.+)" ==> $1 does not strip the leading digits when reduced to "\A[\d]+(.+)"

Using Renamer Lite version 5.76

Thanks, Ric

Offline

#2 2014-08-08 14:40

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,479

Re: Problems with renaming files starting with a sequence of numbers

Hi Ric,

Your first two patterns work as expected:
* RegEx: Replace expression "\A([\d]+)-(.+)" with "$2-$1" (skip extension)
OR
* RegEx: Replace expression "(\A[\d]+)-(.+)" with "$2-$1" (skip extension)

Input: 136037-QP-2012-May-15-unit-a221-01-unit-01-b1-b2-b3-F
Output: QP-2012-May-15-unit-a221-01-unit-01-b1-b2-b3-F-136037

Your patterns make use of regular expressions (not wildcards), so make sure you use RegEx rule.

Offline

#3 2014-08-08 14:45

ricm
Member
Registered: 2014-08-08
Posts: 2

Re: Problems with renaming files starting with a sequence of numbers

Doh!

It would have helped if I'd looked down the list and spotted RegEx rather than slavishly (and somewhat blindly) banging on the door of replacing using wildcards!

Thanks,
Ric

Offline

Board footer

Powered by FluxBB