Copy part of comment to GROUPING in FLAC files

Hi,

I'd like to be able to copy a portion of a tag to a different tag.
For context, I'm using MixedInKey to tag my audio files with keys and energy levels.
I'm writing the values to the comment field, in which I may have already written another value.
I'm also selecting the write energy level in front of grouping option.
However, for FLAC files, the grouping tag isn't being written to.
I'm hoping to be able to use mp3tag to rectify this issue for all my FLAC files.

My Comment field may contain a tag such as "2A - Energy 6 - Zouk"
I want to be able to then write "6" to the Grouping field.

I'd like to be able to do this in bulk for all my FLAC files.

Where do you see that the data is not there? In your player or in MP3tag?

To copy the value following "Energy" to GROUPING, try an action of the type "Format value" for GROUPING
Format string: $regexp(%comment%,.+-(\d+) - .+,$1)
Check the extended tags dialogue Alt-T for success.

I think there is a dedicated field for

INITIALKEY

so you don't have to use COMMENT for this piece of data.

That's correct. the key is properly being written to INITIALKEY by MixedInKey. I am then able to read it in VirtualDJ, after using Mp3tag to delete the tag which VirtualDJ writes itself, since it isn't otherwise respecting my config to read the key from my tag.

The energy level, however, is not being written for FLAC files, as observed both in my player (VirtualDJ), as well as Mp3Tag.

Edit: Your suggestion didn't quite work, but I did notice that there appears to be a dedicated field for 'ENERGYLEVEL' in FLAC files. MixedInKey hadn't said that it would be writing to different tags for different file types. Strange. That tag doesn't appear to be read in VirtualDJ though.

you can test the regular expression in Convert>Tag-Tag.
Try: $regexp(%comment%,.+(\d+) - .+,$1)

Thanks, that updated regex worked. I updated the format string action with it.

For now for my use case, I ended up just copying from the ENERGYLEVEL tag, as it appeared that MixedInKey actually writes to there for all file types. It may be an intermediary tag, before writing to grouping, and it may just be failing to write to grouping for FLAC files.

Your updated regex will be useful definitely, if I use the comment field for anything else in the future.
Appreciate the help.