#1 2010-10-20 23:19

drMerry
Member
Registered: 2010-10-20
Posts: 4

Regex multiple use of expressions

I found one thing in the Regex I would like to be changed.

I have sorted my Music in this way

[First letter albumartist]\AlbumArtist\Album\Discnumer\tracknumber - Trackname

I have a tagging program that can do all this for me, except the first part.


Example (Folder name "Cat Stevens"):


Find:            ((.).*)
replace with: $2\$1
This gives:
C\$1
It should be C\Cat Stevens

I made another regex:
(.)(.*)
$1\$1$2
Result:
C\$1at Stevens

So the problem is, a expression ($n) can only be used once.

Is it posible to change this to unlimited use, so the var is not cleared?

Offline

#2 2010-10-21 10:13

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

Re: Regex multiple use of expressions

Hi welcome.



Find:            ((.).*)
replace with: $2\$1
This gives:
C\$1


Please note that the backslash \ is an regex meta char
and it will "escape" the next char "$" from it special meaning and give you an literal "$".

If you want to insert an literal backslash "\" into an regex
you have to escape this backslash from its special meaning
by prefix it with an another backslash "\\" :




Example

Rule RegEx:
Expre: (.)(.*)
Repla: $1\\$1$2


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 2010-10-23 02:58

drMerry
Member
Registered: 2010-10-20
Posts: 4

Re: Regex multiple use of expressions

can someone be more stupid?
one of the key features of regex, escaping characters.
Thanx....

(of course it works...)

Offline

Board footer

Powered by FluxBB