Copy values between fields with regexp

I have a bunch of files with generic album names like "_misc". In the comment field, they have the real album name, formatted as "album[REAL_NAME]". There may be other text in the comment field before/after the album[] declaration.

So I want to run this regexp on the comment field: album[([^]]+)] and place the match ($1) in the album field, overwriting its current value. How can I do this?

Make a new action:

Action type: Format value
Field: ALBUM
Format string: $regexp(%comment%,'album[([^]]+)]',$1)

That leaves any text before or after the "album[...]" match, which I would think isn't wanted. The following only keeps the text within the square brackets:


Here is a proposal using the action 'Guess values' ...

Action: Guess values
Source format: %COMMENT%
Guessing pattern: %DUMMY%album[%ALBUM%]%DUMMY%

Example ...
COMMENT=... formatted as "album[REAL_NAME]". There may be other text ...


That worked, thank you everyone!