Subject: Re: [Name Mangler Talk] Re: removing zeros from sequence numbers?

From: Martin Gauffin <[email-masked]>
Date: Thu, 23 Aug 2012 04:59:08 -0700 (PDT)

*> But what does the "-" do? :-S 

You have a hyphen in your filename, so the whole thing means: *

Haha, of course. Didn't think of that!

Thank you very much for your help, I'll make sure to visit that PCRE site.

//Martin

---

From: Rob Griffiths <[email-masked]>
Date: Wed, 22 Aug 2012 05:48:58 -0700

On Aug 22, 2012, at 2:53 AM, Martin Gauffin wrote:

> So, the "1-9" means any digit from 1 to 9 right? And they need to be inside brackets cause otherwise it will look for the exact occurrence of "1-9", am I correct?

Yes.

> And the "+" means that there might be another zero after the first one?

It means "at least one of the previously-noted item," i.e. find at least one zero.

> But what does the "-" do? :-S

You have a hyphen in your filename, so the whole thing means:

Find a hyphen, followed immediately by one or more zeros, followed by a non-zero digit, which is saved into $1, so it can easily be placed in the result.

So then the replace just puts back the hyphen we found, along with the digit, leaving out any zeros that met the Find criteria (i.e. one or more of them right after a hyphen, followed by a digit). The rest of the filename (i.e. any more digits) are there already, because they weren't captured by the regex.

> But, say if I really wanted to study regular expressions, is the wikipedia article good for that or does Name Mangler's use of regular expressions differ a lot from what is described in that article?

For the most part, Name Mangler contains an implementation of Perl Compatible Regular Expressions (PCRE): <http://www.pcre.org/>

regards,
-rob.

---

From: Martin Gauffin <[email-masked]>
Date: Wed, 22 Aug 2012 02:53:39 -0700 (PDT)

Thanks for the reply!
Aha, that looks like a more simple solution!
So, the "1-9" means any digit from 1 to 9 right? And they need to be inside 
brackets cause otherwise it will look for the exact occurrence of "1-9", am 
I correct?

It's so funny, cause the more I use the program, the more I realize what it 
CAN do. I'm very glad to have learned about these regexes.

But, say if I really wanted to study regular expressions, is the wikipedia 
article <http://en.wikipedia.org/wiki/Regular_expression> good for that or 
does Name Mangler's use of regular expressions differ a lot from what is 
described in that article?

Thanks a bunch!

/Martin

Den onsdagen den 22:e augusti 2012 kl. 01:09:39 UTC+2 skrev Many Tricks:
>
> On Aug 21, 2012, at 12:37 PM, Martin Gauffin wrote: 
>
> > advanced than I first thought. So I began to read about it on the 
> internet, and voila! I came up with this: 
> > (00(\d)|0(\d\d)) 
> > and in the replace-field i typed: $2$3. 
>
> Nice solution; here's what I was going to propose: 
>
> Find: -0+([1-9]) 
> Repl: -$1 
>
> But if yours works as you wish, then all is good! 
>
> > Thank you for a great application! For me, it's worth MUCH more than the 
> money you charge for it. Daily I work with a large number of files that 
> need to be renamed to a format which corresponds well with another 
> software's import function, and Name Mangler helps me do that quickly and 
> saves me HOURS. 
>
> Thanks for the kind words; I'll pass them along to Peter Maurer, our 
> founder and programmer. 
>
> > Now, getting a grip of these Regular Expressions I will save still more 
> time. 
>
> They're still tricky to me; it's like trying to walk backwards while 
> juggling knives :). 
>
> -rob.

---

From: Rob Griffiths <[email-masked]>
Date: Tue, 21 Aug 2012 16:09:39 -0700

On Aug 21, 2012, at 12:37 PM, Martin Gauffin wrote:

> advanced than I first thought. So I began to read about it on the internet, and voila! I came up with this:
> (00(\d)|0(\d\d))

Find: -0+([1-9])
Repl: -$1

> Thank you for a great application! For me, it's worth MUCH more than the money you charge for it. Daily I work with a large number of files that need to be renamed to a format which corresponds well with another software's import function, and Name Mangler helps me do that quickly and saves me HOURS.

Thanks for the kind words; I'll pass them along to Peter Maurer, our founder and programmer.

> Now, getting a grip of these Regular Expressions I will save still more time.

They're still tricky to me; it's like trying to walk backwards while juggling knives :).

-rob.

---

From: Martin Gauffin <[email-masked]>
Date: Tue, 21 Aug 2012 12:37:12 -0700 (PDT)

Hi again,
I managed to do it myself. By looking at the other posts I started to 
realize that Regular Expressions are much more advanced than I first 
thought. So I began to read about it on the internet, and voila! I came up 
with this:
(00(\d)|0(\d\d))
and in the replace-field i typed: $2$3.

saves me HOURS. Now, getting a grip of these Regular Expressions I will 
save still more time.

Thank you VERY much! 

/Martin