You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bharath <bh...@gmail.com> on 2013/12/13 09:57:04 UTC

Facing problem in regex when used in Simple Expression Language

Hi,

    I have a simple route in which it will transfer a file from one file
endpoint to other file endpoint as below

<from uri="file:/mnt/input" />
	<setHeader headerName="CamelFileName" >
			<simple>${file:name.noext} regex '([^_]*).*'.${file:ext}</simple>
	</setHeader>
<to uri="file:/mnt/output" />

For example if i place a file "abcd_20131209.csv" in /mnt/input i should get
abcd.csv in /mnt/output
but the output file name what i am getting is "abcd_20131209 regex
'([^_]*).*'.csv"

Am i missing something in the regex?

Can someone help me out in this?

Camel Version - 2.10.0


Cheers!!!
Bharath.R



--
View this message in context: http://camel.465427.n5.nabble.com/Facing-problem-in-regex-when-used-in-Simple-Expression-Language-tp5744717.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Facing problem in regex when used in Simple Expression Language

Posted by "kraythe ." <kr...@gmail.com>.
<simple>${file:name.noext}.regex '([^_]*).*'.${file:ext}</simple>

Regex is a method call on the string return from the file:name.noext


*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Fri, Dec 13, 2013 at 2:57 AM, Bharath <bh...@gmail.com> wrote:

> Hi,
>
>     I have a simple route in which it will transfer a file from one file
> endpoint to other file endpoint as below
>
> <from uri="file:/mnt/input" />
>         <setHeader headerName="CamelFileName" >
>                         <simple>${file:name.noext} regex
> '([^_]*).*'.${file:ext}</simple>
>         </setHeader>
> <to uri="file:/mnt/output" />
>
> For example if i place a file "abcd_20131209.csv" in /mnt/input i should
> get
> abcd.csv in /mnt/output
> but the output file name what i am getting is "abcd_20131209 regex
> '([^_]*).*'.csv"
>
> Am i missing something in the regex?
>
> Can someone help me out in this?
>
> Camel Version - 2.10.0
>
>
> Cheers!!!
> Bharath.R
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Facing-problem-in-regex-when-used-in-Simple-Expression-Language-tp5744717.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>