title: How to use java String.matches(str) method in Velocity Templates
body: <p>I'm attempting to do a match on the user agent in velocity templates.</p>
  
  <p>$ua does print out but Matches! does not. What am I doing wrong?</p>
  
  <pre><code>#set( $ua = $request.getHeader('User-Agent'))
  &lt;p&gt;$ua&lt;/p&gt;
  #if( $ua.matches('/Windows.(NT|XP|ME|9)/')) 
  &lt;p&gt;Matches!&lt;/p&gt;
  #end
  </code></pre>