Hi Your regular expression is wrong. You need to have it match all the digits.
I added an unit test public void testSimpleRegexp() throws Exception { exchange.getIn().setBody("12345678"); assertPredicate("${body} regex '\\d+'", true); assertPredicate("${body} regex '\\w{1,4}'", false); exchange.getIn().setBody("tel:+97444549697"); assertPredicate("${body} regex '^(tel:\\+)(974)(44)(\\d+)|^(974)(44)(\\d+)'", true); exchange.getIn().setBody("97444549697"); assertPredicate("${body} regex '^(tel:\\+)(974)(44)(\\d+)|^(974)(44)(\\d+)'", true); exchange.getIn().setBody("tel:+87444549697"); assertPredicate("${body} regex '^(tel:\\+)(974)(44)(\\d+)|^(974)(44)(\\d+)'", false); exchange.getIn().setBody("87444549697"); assertPredicate("${body} regex '^(tel:\\+)(974)(44)(\\d+)|^(974)(44)(\\d+)'", false); } On Tue, Jun 2, 2015 at 11:16 AM, tesla <remz...@gmail.com> wrote: > Hi , I need a regex filter for msisdn(mobile telephone number) . I need to > check first 3 digits then i need to check 2 following digits.First 3 digits > should be 974 then following two digit should be 44.Therefore these two > msisdns should pass : tel:+97444549697 and 97444549697. So I write the > following regex : ^(tel:\+)(974)(44)|^(974)(44) > I tested it with some regex test tools and it seems it is working but when I > try to use it with camel simple it is not working. > How I use regex is the following : ${in.header.msisdn} regex > '^(tel:\+)(974)(44)|^(974)(44)' > > What I am doing wrong? > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Simple-Language-regex-fails-tp5767786.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/