Regex w/ String Interpolation

question

#1

I want to do something along the lines of:

a = "focus"
ismatch(r"$(a)\s*:\s*true", "# focus: true")

But this doesnt work // probably similar to issue #1797


What is the correct way to do this?

eval( parse( "ismatch(r\"$(a)\\s*:\\s*true\", \"# focus: true\")" ) )

feels super dirty


Can I interpolate a string in a regular expression?
#2
a = "focus"
r = Regex("$(a)\\s*:\\s*true")
ismatch(r, "# focus: true")