title: How to escape regular expression characters from variable in JMeter?
body: <p>Problem is simple. I have regular expression used to extract some data from response. It looks like that:</p>
  
  <pre><code>&lt;input type="hidden" +name="reportpreset_id" +value="(\w+)" *&gt;${reportPresetName}&lt;/td&gt;
  </code></pre>
  
  <p>Problem is that variable <code>${reportPresetName}</code> may contain characters used by regular expression like parenthesis or dots.<br>
  I've tried to surround this variable with <code>\Q</code> and <code>\E</code> (based on <a href="http://www.regular-expressions.info/reference.html" rel="nofollow">that</a>) but apparently these markers don't work (apparently Java supports this markers so I'm confused).
  When I'm adding that markers even then this expression fails for any content of  <code>${reportPresetName}</code> variable (even for cases when it was working without those markers).</p>
  
  <p>I've checked <a href="http://jmeter.apache.org/usermanual/functions.html" rel="nofollow">list of functions in JMeter</a>, but I didn't found anything useful.
  Does anyone know how to escape regular expression characters in JMeter?</p>
  
  <p><hr>
  update:<br>
  When I'm using this <code>\Q</code> and <code>\E</code> with assertion it fails. When I'm doing a copy of regular expression from assertion log in "View Results Tree" and testing it on recorded response data it works! So it looks like some kind bug in JMeter.</p>