RegExp Help


#1

Hi,

I have tried the following with no success

regexp: (\s<!--coloro:#A0522D-->'.)
replace: \U$0

and replaced the red character with [, " and ' with no consistent success.

For example the above regexp produces this:
The 'torchum' Never Stops -> The 'Torchum' Never Stops <- which I want.
The Massive Improve'lence -> The Massive Improve'Lence <- which I don't want.

Any help would be appreciated.
Regards,
niche99


#2

Your action could not possibly work as \U in the replace is not how you go about doing this. It only works to find a non-upper case character anyway.
See http://help.mp3tag.de/options_format.html#regexp

For your problem try this.

Begin Action Group _Script Test#TEST

Action #1 Actiontype 4: Replace with regular expression Field ______________: TITLE Regular expression _: \s+'(.)

Replace matches with:

$upper($1) [_] Case sensitive comparison

End Action Group _Script Test#TEST (1 Action)

This finds:

\s+ \s Space character unlimited times + ' The ' character (.) Start capture ( with . representing any character and ) closing the capture

Replaces:

$upper Converts ($1) Captured like above

See http://help.mp3tag.de/main_scripting.html#general for more info.


#3

The problem seems to be the punctuation mark "Apostroph", which is a word delimiter.
Therefore it is not so easy to code a lookbehind or lookahead.
But there is a workaround, which can help quickly.

For the capitalization use the function $caps2() and subsequently do the trick using the function $regexp().

$regexp($caps2(%FIELD%,' (["'),'(\s\x27)(.)','$1\u$2')

... or ...

$regexp($caps2(%FIELD%,' (["'),'\s\x27.','\U$0')

... or ...

$regexp(%FIELD%,'(^|\x20\x27|[[(\x20\x22])(.)','$1\u$2')

Apply the above expressions by action "Format value" or by converter "Tag - Tag".

If you want to apply the capitalization rule to all tag-fields at once, then use ...

Actiontype 4: Replace with regular expression

Field ______________: _TAG
Regular expression _: (^|\x20\x27|[[(\x20\x22])(.)
Replace matches with: $1\u$2

[_] Case sensitive comparison

Examples
the 'torchum' never stops -> The 'Torchum' Never Stops
the massive improve'lence -> The Massive Improve'lence
aaa bbb(ccc[ddd"eee 'fff -> Aaa Bbb(Ccc[Ddd"Eee 'Fff
aaa bbb(ccc[ddd"eee'fff 'ggg -> Aaa Bbb(Ccc[Ddd"Eee'fff 'Ggg

See also ...
Großschreibung nach Hochkomma mit caps2?

DD.20120728.1314.CEST
Edit.DD.20120729.0842.CEST


Schreibweise anpassen
#4

The same not be done with:

Begin Action Group _Script Test#TEST

Action #1 Actiontype 4: Replace with regular expression Field ______________: _TAG Regular expression _: (\B|^)(\(|\[|"|')(.) Replace matches with: $1$2$upper($3) [_] Case sensitive comparison

End Action Group _Script Test#TEST (1 Action)

Resulting in:

(the [torchum' "never 'stops blank(the[torchum"never'stops >>>> (The [Torchum' "Never 'Stops blank(the[torchum"never'stops

by breaking up the different parts like not a word boundary OR start of string / (["'' / any one character to capture as $1, $2 & $3 (changed to upper-case) it seems to work. If you don't separate them like this you get unwanted results.

Plus one thing with using the action 'replace with regular expression' you can affect _TAG (All tags) like the example above whereas with the format action you can't.

Anybody know why mp3tag doesn't pick up the start of the string '(the [torchum' "never...' by using the \B. My fix was to put in a '|^' to fix the problem.


Upper case after symbols: . - ( [