# Can I interpolate a string in a regular expression?

**URL:** <https://discourse.julialang.org/t/can-i-interpolate-a-string-in-a-regular-expression/10763>\
**Category:** New to Julia\
**Tags:** regex, string-interpolation\
**Created:** [May 7, 2018, 5:00pm UTC](https://discourse.julialang.org/t/can-i-interpolate-a-string-in-a-regular-expression/10763 "2018-05-07T17:00:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![NiclasMattsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niclasmattsson/32/21988_2.png) [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Post date:** [May 7, 2018, 5:07pm UTC](https://discourse.julialang.org/t/can-i-interpolate-a-string-in-a-regular-expression/10763/2 "2018-05-07T17:07:36Z")

</div>

In an ideal world this thread would pop up as a suggestion as you typed the title of your post:

> [@Regex w/ String Interpolation](https://discourse.julialang.org/t/regex-w-string-interpolation/3545):
>
> 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](https://github.com/JuliaLang/julia/issues/1797) What is the correct way to do this? eval( parse( "ismatch(r\"$(a)\\s\*:\\s\*true\", \"# focus: true\")" ) ) feels super dirty

---

_[View the full topic](https://discourse.julialang.org/t/can-i-interpolate-a-string-in-a-regular-expression/10763)._
