Regex for "[Live]"

Hi everybody,

I want to tag live albums in a special manner.
All titles of a live album should get a postfix "[Live]" and also the album tag itself.
But if an album or title already contains a "[Live]" at the end it should keep it as is.
This should also include variations like "[Live At Budokan]"

Any idea how I can do this with an action?

I know that an easy regex-match would be

\s*(\[Live.*\])\s*$

But how can I negate it (matching only lines which doesn't contain this?
And / Or combine it with a replacement?

Could somebody please push me to the right direction?
As we say in German: "Ich stehe auf dem Schlauch" :wink:

best regards in advance,
Matthias

Action: Format Value
Field: TITLE
Formatstring: $if($eql($regexp(%title%,'.\s[Live.]\s*',XXXXX),XXXXX),%title%,%title% '[Live]')

and the same for album

The regex could be expanded to match also live and LIVE and round parenthesis.

Thanks a lot!

That trick with replacing the string only for comparison points me to the right direction :w00t:

This is what I'm using now (for the title):

$if($eql($regexp(%title%,'[(\[]Live[^)\]]*[)\]]\s*$',XXXXX,1),%title%),%title% '[Live]',$regexp(%title%,'[(\[]Live([^)\]]*)[)\]]\s*$','[Live$1]',1))

It ignores case (fourth parameter to regexp), also finds "(Live)" and either adds a "[Live]" to the end or replaces the existing one to be always surrounded by a "[", "]" pair.
Example:

"Hello My Friend"                   -> "Hello My Friend [Live]"
"Hello My Friend [Live]"            -> "Hello My Friend [Live]"
"Hello My Friend  (Live, US) "      -> "Hello My Friend [Live, US]"
"Hello My Friend (Live, US]"        -> "Hello My Friend [Live, US]"

The latter is an accident because I'm unable to match only character "pairs" (so that a leading "(" only matches to a closing ")" and not to "]")

But that's O.K.

You made my day!

good one!