I'm trying to write a regular expression in an Apache Velocity template to check if a string contains a URL.
My code is below. The variable $quoteValue is currently set to contain the string "This is a pullquote test: http://www.google.com"
##Set the regular expression to be used to find a URL
#set($urlRegex = '(.*)(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?(.*)')
Is there a match? $quoteValue.matches($urlRegex)
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.