I'm having a problem with $regexp when I use a set (e.g. "[\w\s]" or "[^\\]") in a regular expression.
My music is structured with the genre as the 2nd directory after root
e.g. S:\Tom\Rock\Genesis etc\Mike & The Mechanics\1990 Interview\01 Mike Rutherford.mp3
I've set up an action group with a Format Value entry, Field GENRE,
Format String: $regexp(%_folderpath%,^.{3}\w+\\(\w+)\\.+$,$1)
This works correctly, returning 'Rock', but it only handles single words in the first directory name. When I change it to
"$regexp(%_folderpath%,^.{3}[\w\s]+\\(\w+)\\.+$,$1)" it returns the complete %_folderpath%
The preferable solution "$regexp(%_folderpath%,^.{3}[^\\]+\\(\w+)\\.+$,$1)" also returns the complete %_folderpath%
Hmm, yes, please study the Mp3tag scripting language in detail, to get to know the exceptions.
Some characters are designed to have a special meaning, e. g. the square brackets.
They need to be escaped when they should be used in their literal meaning in a subsequent language like the Regular Expression Language.