Regex for missing title


#1

Newbie at this but have a lot working right now - just got stumped on MP3Tag's treatment of blank tags.

I have multiple files that display [Untitled] or [Untitled Track] for the %title% field.

I've tried to test using $strstr and $len - but $len seems to return the length as if it's filled in,
and $strstr doesn't seem to be able to find "Untitled" anywhere in the string.

I've read thru the regex FAQ but nothing seems to indicate how to handle the possibilities

I just want to replace any of these missing titles or titles starting with "[Untitled" with
"Untitled " + %track%

Is this has hard as I'm making it out to be?

Thanks for any help
Don


#2

There's different ways of doing this but one is:

Begin Action Group _Script Test#TEST

Action #1 Actiontype 5: Format value Field ______: TITLE Formatstring: $regexp(%title%,'(?i)^\[untitled[^]]*\]'$,$1 $num(%track%,2))

End Action Group _Script Test#TEST (1 Action)

It searches for the %title% to start with '[' then untitled. It then searches for anything but a ']' between 0 and an unlimited no. of times. Then a ']' This will match both:

[Untitled]

[Untitled Track]

And replace them with your desired format with the %track% formatted with 2 padded numbers.

See attached explanation of how regexp works.




#3

One possible approach ...
Converter: Tag - Tag
Field: TITLE
Format string: $ifgreater($strstr(%TITLE%,'[Untitled'),0,'Untitled '%TRACK%,%TITLE%)

DD.20121119.2015.CET


#4

Thanks for the quick reply - I'll give it a shot.

I assume I can try this from the Tag -> filename rename window?


#5

Use :mt_ttt:


#6

That did it - thanks very much