#1 2012-08-27 20:10

Remon
Member
Registered: 2011-03-10
Posts: 11

Add regex / code checker

I learned another regex as the one Renamer uses.

I often have troubles to find out what is wrong when I insert regex code in Renamer.

It would be nice if there is regex/code checker in Renamer.
(and evt. a drop down list of all regex codex variables in Renamer)

p.e.
I'm trying now for almost an hour to change these files:

input:
firstword_secondword_01.txt
firstword_secondword_02.txt
firstword_secondword_03.txt
firstword_secondword_04.txt
etc

to
output:
secondword_firstword_01.txt
secondword_firstword_02.txt
secondword_firstword_03.txt
secondword_firstword_04.txt
etc


I added this in rearrange:
(.*)_(.*)_(.*)

New pattern:
$2_$1_$3


but nothing happens.
Btw.... what did I wrong?

Offline

#2 2012-08-27 21:12

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Add regex / code checker

Hi Remon.


Remon wrote:

I learned another regex as the one Renamer uses.

I often have troubles to find out what is wrong when I insert regex code in Renamer.

It would be nice if there is regex/code checker in Renamer.
(and evt. a drop down list of all regex codex variables in Renamer)

Maybe our wiki can help you a bit:
http://www.den4b.com/wiki/ReNamer:Regular_Expressions



p.e.
I'm trying now for almost an hour to change these files:

input:
firstword_secondword_01.txt

output:
secondword_firstword_01.txt


I added this in rearrange:
(.*)_(.*)_(.*)

New pattern:
$2_$1_$3


but nothing happens.
Btw.... what did I wrong?

Your expression work for the examples you have provided.
1) RegEx: Replace expression "(.+)_(.+)_(.+)" with "$2_$1_$3" (skip extension)
Perhaps your examples differs from your real file names ?



Ah, now i see you want to use the Rearrange Rule?
You would not use RegularExpression in Rearrange Rule.
(The "$1"-term is more like a var in Perl, not like a group-reference in RegEx)

Just enter the delimiter to split the string (here the underscore "_")
which will split your string into three parts ("firstword" and "secondword" and "01")
and this are stored in variables which you can excess by $1, $2 and $3.

Then just rearrange this vars in your output and add the delimiter again (if wanted):
1) Rearrange: Split by delimiters "_", New pattern "$2_$1_$3" (skip extension)

See our wiki
http://www.den4b.com/wiki/ReNamer:Rules:Rearrange
http://www.den4b.com/wiki/ReNamer:Rules … e_Examples


.


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2012-08-28 09:01

Remon
Member
Registered: 2011-03-10
Posts: 11

Re: Add regex / code checker

Thank you Stefan.

So simple..
It would be nice if I could also use the group reference in Renamer.
I can group pieces of the name different as only by separator.

You see, for me Renamer is not easy to use because of my previous experiences in other software (p.e. the group-reference).
I find myself often read the Renamer manual sad

Believe me that I once did a search to find out how to add a counter in Renamer.
I searched on the net but found nothing other then a userscript in pascal.
Why was it so complicated to find out how to add a counter?
Then I noted that you call it "Serialize" smile

Have a nice day smile
Remon

Offline

#4 2012-08-30 12:10

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: Add regex / code checker

Hi Remon,

The wiki too has a local search field.
If you search for "counter", the "serialize rule" page comes up right at the top in the search results. smile

Offline

#5 2012-09-04 20:12

Regex223
Member
Registered: 2012-09-04
Posts: 12

Re: Add regex / code checker

Use Expresso to check your code and it is free

Offline

#6 2012-09-06 03:20

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: Add regex / code checker

RegEx223 wrote:

Use Expresso to check your code and it is free

It may be using a different flavor of RegEx, in which case the results would be misleading.

Instead, first enter your RegEx rule in ReNamer as usual and then press SHFT+A.
ReNamer launches Analyze Text window, where you can enter any arbitrary text, and check out the effect of your RegEx rule.
In fact, this approach has an additional advantage: It shows the cumulative effect of all selected rules (not just RegEx).

See wiki for details: http://www.den4b.com/wiki/ReNamer:Analyze

Last edited by narayan (2012-09-06 03:21)

Offline

Board footer

Powered by FluxBB