Replacing genre in embedded CUESHEET

Using a Format Value Action I am trying to replace the genre in the embedded cuesheet with the actual genre (which has changed since first rip)

Trying this, but its not working

$regexp(%cuesheet%,’^(.*?REM GENRE )(.+?)$’,‘$1”%GENRE%”’)

The double quotes round %genre% are to handle genres with a space in them

Any ideas what I am doing wrong.

Thanks
G

Double quotes: use " not ”
Single quotes: use ' not ’

Thanks. That is a lot better now but it is not picking up the genre correctly instead its replacing the old genre with the text %GENRE%.

G

I would say that the last part should be
,$1%GENRE%)
without any quotes

CUESHEET <== $regexp(%cuesheet%,'^(.*REM GENRE )(.+?)([\r\n]+.*)$','$1'%GENRE%'$3') ... or ... CUESHEET <== $regexp(%cuesheet%,'(.*REM GENRE ).+?($.*)','$1'%GENRE%'$2')

DD.20160115.1215.CET

Excellent, thanks this works (I used the second shorter version) perfectly.
I now want to add an If condition to check whether the GENRE has a space in it or not. If it does it needs to be inserted in quotes in the cuesheet; if no space it does not need quotes. I tried this but it just shows the code in the cuesheet

$regexp(%cuesheet%,'(.*REM GENRE ).+?($.*)','$1($if($eql($strstr(%GENRE%,\s)),0,'%GENRE%',"'%GENRE%'"))$2')

I have tested my regexp proposal with a tagfield set to GENRE <== 'Pop Rock' ...
that means within the tagfield GENRE there are no quote characters, ...
and the regexp works.

But within the cuesheet itself ...
https://de.wikipedia.org/wiki/Cuesheet
https://en.wikipedia.org/wiki/Cue_sheet_(computing)
... there are double quotes used in the REM lines, ...
when there is ... t e x t ... which contains space characters ... or not.

Therefore, for sure, write always double quotes around the text.

CUESHEET <== $regexp(%cuesheet%,'^(.*REM GENRE )(.+?)([\r\n]+.*)$','$1"'%GENRE%'"$3') ... or ... CUESHEET <== $regexp(%cuesheet%,'(.*REM GENRE ).+?($.*)','$1"'%GENRE%'"$2')

Maybe you have to repair doubled double-quotes ...

CUESHEET <== $replace(%cuesheet%,'""','"')

DD.20160115.1500.CET

The quoted formatstring has no correct syntax.

It should be written as ...

$regexp(%cuesheet%,'(.*REM GENRE ).+?($.*)','$1'$ifgreater($strstr(%GENRE%,' '),0,'"'%GENRE%'"',%GENRE%)'$2') ... or ... $regexp(%cuesheet%,'(.*REM GENRE ).+?($.*)','$1'$ifgreater($strchr(%GENRE%,' '),0,'"'%GENRE%'"',%GENRE%)'$2')

DD.20160115.1803.CET

Thanks so much, I messed around for ages trying to get the $if statement to work. This works perfectly. I used the second version.

Thanks

G