Hi,
I want to create an action to replace a hyphen with a round bracket this is possible if i use a Format Value action $regexp(%title%, - , '('), but i also want to exclude the occasions where there is a digit before and after the hyphen \d - \d.
How will i accomplish that?
If it is always the second hyphen that is to be left alone, then try: $regexp('Give It To Me - Vocal Club Edit (95 - 122 Transition)',(.*?) - (.*),'$1' '(''$2')
This one works but i want to be sure that even if the \d - \d string is the first one will remain intact.
I know i could use a filter like TITLE MATCHES " - " AND NOT TITLE MATCHES "\d - \d" but i was wondering if there is a regular expression which would do the same.
You could try it with $regexp(%title%,(\D) - (\D),'$1 ($2'))
for your given example.
This would transform the content in %TITLE% from Give It To Me - Vocal Club Edit (95 - 122 Transition)
into Give It To Me (Vocal Club Edit (95 - 122 Transition))
Please test it carefully with some more real world examples.
Short explanation:
Search for a combination of
any non-digit character (and put it into the captured group $1)
followed by a space a hyphen a space
followed by any non-digit character (and put it into the captured group $2)
Then rearrange found combinations with the
content of $1 followed by a space an opening round bracket and the
content of $2
then add a closing round bracket at the end
Hey @LyricsLover i totally missed this one.
I gave it some tries and it works, but i had to remove the last round bracket because otherwise i had a bracket at the end of every title, even those without any bracket at all.
The one that works for me is $regexp(%title%,(\D) - (\D),'$1 ($2')
if i use this one, the title will transform to Give It To Me (Vocal Club Edit (95 - 122 Transition)
afterwards i use another regular expression to close any open bracket if there is any.
Then the title will be transformed to Give It To Me (Vocal Club Edit) (95 - 122 Transition)