Regular expression in an Apache Velocity template to check if a string contains a URL
<p>I'm trying to write a regular expression in an Apache Velocity template to check if a string contains a URL.  </p>

<p>My code is below.  The variable $quoteValue is currently set to contain the string "This is a pullquote test: <a href="http://www.google.com" rel="nofollow">http://www.google.com</a>"</p>

<pre><code>##Set the regular expression to be used to find a URL
            #set($urlRegex = '(.*)(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&amp;:/~+#-]*[\w@?^=%&amp;/~+#-])?(.*)')
            Is there a match? $quoteValue.matches($urlRegex)
</code></pre>

<p>However, the $quoteValue.matches($urlRegex) method always returns false, when I would expect it to return true in this case.  How can I get it to recognise that the string contains a URL? I'm assuming this is something to do with escaping special characters.</p>