I’m trying to use Apache Camel (with Spring XML) to check if a message body matches a regex:
<when>
<simple>${body} regex 'https?://(?:www\.)?twitter\.com[^\w]+'</simple>
<to uri="activemq:queue:test"/>
</when>
So http://www.twitter.com/user in the body of a message should be moved to the ‘test’ queue.
The regex matches in Rad Regular Expression Designer, but Camel is still not moving the message to the ‘test’ queue. Any ideas why this isn’t working?
java.util.regex requires a full match, so if that is what Apache Camel uses (?) then your hypothesis is correct. Wouldn’t the easiest fix be to put “.*” before and after the regex?