Use variable from Scratch with replaceRE

Hi,

I stored a string inside a if statement with $.Scratch.Set "var" "value". This works great, but now I want to reuse it outside of the if statement in a replaceRE statement:

`{{ .Content | replaceRE “<div(.|\n)?class=“slides”(.|\n)?>(.|\n)?(.|\n)?(.|\n)*?” ($.Scratch.Get “var”) | html }}

Any ideas how to do this?

Not tested and on a phone, but with the above, have you tried first assigning the scratch to a variable? Also, I don’t think you’ll need to add “html” since .Content automatically parses the markdown to HTML…

1 Like

Thanks, this works great!

1 Like