Replace with regular expression ... weirdness

Okay ... can anyone give me an explanation why the following "Replace with regular expression" gives me the weirdness it does...

Field: Comment
Regular expression: (".*")
Replace matches with: $caps($1)

so with most things it works as expected so...
from "a new flame"
becomes
from "A New Flame"

but...
from "wednesday morning, 3 a.m."
becomes
from "WednesdaY mOrning

Just to clarify; I'm wanting to capitalise everything within the " marks. I'm sure theres something simple I've missed and it's the , thats causing the trouble. Just don't know why and the (seemingly) random capitals are really weird!

Eloise

If you want to modify the format of a complete field, I would use an action of the type "Format tag-field", in this case for COMMENT.
Format string: $caps(%comment%)

There seems to be a misunderstanding of how to use the Action "Replace using Regular Expression".

Action: Format value Field : COMMENT Formatstring: $upper(%COMMENT%) From: "wednesday morning, 3 a.m." To : "WEDNESDAY MORNING, 3 A.M."

... or ... maybe you want to do ...

Action: Format value Field : COMMENT Formatstring: $caps(%COMMENT%,'" .') From: "wednesday morning, 3 a.m." To : "Wednesday Morning, 3 A.M."

... and you should consider, whether it is allowed to apply a Mp3tag scripting function like $caps() within the replacement part of the Action "Replace using Regular Expression".

Your example let assume that the embedded function $caps uses the part of the $1 parameter, following the comma, as the second parameter for its own parameter list.
Therefore the characters 'a' and 'm' and the other ones trigger the upcasing of the following letter, ...
e. g. from 'mo' to 'mO'.

The expression $caps($1) will be resolved to ... $caps(from "wednesday morning, 3 a.m.").
Therefore the function $caps works as designed: ...
change each letter to upcase character when following one character, ...
which is defined in the character set ' ."3am' (space,dot,double-apostrophe,3,a,m).
Therefore the output is ...
from "WednesdaY mOrning"
This looks correct.

Upcase all characters, which are enclosed in double apostrophes at end of the given string ...

Action: Format value Field : COMMENT Formatstring: $regexp(%COMMENT%,'^(.+?)(".+?")$','$1\U$2') From: from "wednesday morning, 3 a.m." To : from "WEDNESDAY MORNING, 3 A.M."

Upcase each character, when it has a leading space, double-apostrophe, point character ...

Action: Format value Field : COMMENT Formatstring: $regexp(%COMMENT%,'(?<=[ ".])(.)','\u$1$2') From: from "wednesday morning, 3 a.m." To : from "Wednesday Morning, 3 A.M."

DD.20150520.1354.CEST, DD.20150520.1618.CEST

That wouldn't work (as I want it to)...

I think you slightly (as did the other reply below yours) misread my post (or I wasn't clear).

The complete tag for comment is: from "wednesday morning, 3 a.m." - so everything in bold including the word from.

I only want to capitalist the part within "quotes".

If I can't do this then fine, but just curious why it works in some cases, but not in others. I do now have an explanation, just not sure if (a) I'm doing something Florian never intended to work or (:sunglasses: there is a bug which I've discovered.

Ahh I think I understand what you are saying ...

The command is being interpreted as $caps(wednesday morning, 8 A.M.)
so its looking for a new word after every A and every M as well as after a . and a [space].

I have seen similar functions mentioned (such as uppercase letter in names after a Mc or Mac ... but perhaps not quite as complicated ...

Just as a follow up...

I ended up adding a replace , with § before the replace with regular expression command, then afterwards replace § with , and it all works fine. Just need to remember can't use such commands where , are in the string.