How can I get parts from a tag using regex and add them to an other?

Greetings to community!!!

What I am trying to do is to get some parts from comment tag and add them to some custom tags. For example, I have a track with this comment tag "Real Bitrate: 320 | Spectrum Frequency: 20045 |" and I want to get only the number 320 and 20045 and add them to "Real Bitrate" and "Spectrogram" custom tags. Can someone help me on how to do this? Any regex example or something?

Thank you for your time!!!

If you have your values 320 and 20045 always separated with a space before and after the numbers, you can use this new Action:

Type: Format value
Field: REAL BITRATE
Format String:
$regexp(%comment%,'.* (\d+) .* (\d+) .*',$1)

image

Repeat it for Spectrogram and use the
Field: SPECTROGRAM
Format String:
$regexp(%comment%,'.* (\d+) .* (\d+) .*',$2)

Short explanation for the regular expression:
Search in the %comment% tag for
anything before a space followed by opening bracket, numbers and followed by a closing bracket
a space
anything before a space followed by opening bracket, numbers and followed by a closing bracket
a space
anything else
The first found number will be available in $1, the second number in $2

1 Like

Or in one go:
Try an action of the type "Guess value" (import tag fields).
Source: $regexp(%comment%,'.* (\d+) .* (\d+) .*',$1==$2)
Target format string: %REAL BITRATE%==%SPECTROGRAM%

1 Like

Thank you both for your answers, your really helped me!!! :slightly_smiling_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.