regexp how can i get text between [] from directory to ALBUM

Hello,

i want to extract the text Germany between [ and ] and add this to the Album Tag

my folder is C:\MP3\BAND-NAME\ALBUM-NAME[Germany]</b>

My action is "tag field format" with
Field : ALBUM
Formatstring : %album% $regexp(%_directory%,[(.*?)],$1)

but i get REGEXP ERROR

any suggestions?
Thanks in advance

Try $regexp(%_directory%,'.[(.)]',$1)

In Mp3tag the square brackets clamp [ ] have the special meaning of "optional text", ...
therefore the square brackets have to be enclosed in single apostrophes, when they should be used literally.
Your formatstring will be syntactically correct this way: $regexp(%_directory%,'['(.*?)']',$1)
... but the result is not what you want.

Try this ...

Action "Format value" Tag-Field : ALBUM Formatstring: %ALBUM%' '$regexp(%_directory%,'^.+?\[(.+?)\]$','$1') ... or ... Formatstring: %ALBUM%$regexp(%_directory%,'.*\[(.*)\].*',' $1') _DIRECTORY : 'ALBUM_NAME[Germany]' From ALBUM : 'The Album from' To ALBUM : 'The Album from Germany'

DD.20150829.1935.CEST

:smiley: your version works, thank you.