You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rodrigo Valerio <rs...@gmail.com> on 2009/07/01 20:30:14 UTC
camel 2.0-M2 regex bug
The regex in the code above is never true in 2.0-M2
from("direct:a").setBody(constant("000000000001111111"))
.choice()
.when( body(String.class).regex("^.*") ).process( new MyProcessor() )
.otherwise().end
In 2.0-M1 is ok.
In java Pattern/Matcher it runs ok too.
This regex is to verify if the line starts with "0".
Anyone know a workaround for this?
I need a body(String.class).startsWith("0") or similar... In file processor
this is very usefull...
--
View this message in context: http://www.nabble.com/camel-2.0-M2-regex-bug-tp24294888p24294888.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel 2.0-M2 regex bug
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jul 1, 2009 at 8:30 PM, Rodrigo Valerio<rs...@gmail.com> wrote:
>
> The regex in the code above is never true in 2.0-M2
> from("direct:a").setBody(constant("000000000001111111"))
> .choice()
> .when( body(String.class).regex("^.*") ).process( new MyProcessor() )
> .otherwise().end
>
Hmm let me create an unit test based on this to see whats the issue.
Thanks for reporting.
> In 2.0-M1 is ok.
> In java Pattern/Matcher it runs ok too.
> This regex is to verify if the line starts with "0".
>
> Anyone know a workaround for this?
> I need a body(String.class).startsWith("0") or similar... In file processor
> this is very usefull...
Yeah good idea lets add those predicates to the builder as well.
startsWith/endsWith/constains (I think its already there)
> --
> View this message in context: http://www.nabble.com/camel-2.0-M2-regex-bug-tp24294888p24294888.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: camel 2.0-M2 regex bug
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jul 1, 2009 at 8:30 PM, Rodrigo Valerio<rs...@gmail.com> wrote:
>
> The regex in the code above is never true in 2.0-M2
> from("direct:a").setBody(constant("000000000001111111"))
> .choice()
> .when( body(String.class).regex("^.*") ).process( new MyProcessor() )
> .otherwise().end
>
> In 2.0-M1 is ok.
> In java Pattern/Matcher it runs ok too.
> This regex is to verify if the line starts with "0".
You regex is wrong
It should be "^0.*$"
This works for me
from("direct:a")
.choice()
.when(body(String.class).regex("^0.*$")).to("mock:result")
.otherwise().to("mock:other")
.end();
>
> Anyone know a workaround for this?
> I need a body(String.class).startsWith("0") or similar... In file processor
> this is very usefull...
> --
> View this message in context: http://www.nabble.com/camel-2.0-M2-regex-bug-tp24294888p24294888.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus