2016-06-07 43 views
0

我的保险丝蓝图正在从CSV读取。我试图过滤掉没有任何text.i.e的行。用','使用正则表达式。Apache Camel Regex检查行是否包含字母

代码

<choice id="_choice1"> 
    <when id="_when1"> 
     <simple>${body} regex '[a-z].*'</simple> 
     <log id="_log1" message="Data --> ${body}"/> 
    </when> 
    <otherwise id="_otherwise1"> 
    <log id="_log2" message="otherwise --> ${body}"/> 
    </otherwise> 
</choice> 

从下面CSV数据。

Textbox1,,,,,,,,,,,,,,,,,,,,,,,,,,, 
Report Date 11/05/2016,,,,,,,,,,,,,,,,,,,,,,,,,,, 
,,,,,,,,,,,,,,,,,,,,,,,,,,, 
SiteCode,Site_Description,SiteModulesComplted, 
,,,,,,,,,,,,,,,,,,,,,,,,,,, 
123,abc,my site, java training, 

输出

INFO otherwise --> Textbox1,,,,,,,,,,,,,,,,,,,,,,,,,,, 
INFO otherwise --> Report Date 11/05/2016,,,,,,,,,,,,,,,,,,,,,,,,,,, 
INFO otherwise --> ,,,,,,,,,,,,,,,,,,,,,,,,,,, 
INFO otherwise --> SiteCode,Site_Description,SiteModulesComplted, 

我所经历的所有线路被路由到其他。不知道我用正则表达式做了什么错误。

如果有人可以请求帮助。

回答

0

您的正则表达式[a-z].*表示一个小写字母后跟任意字符。以上都不符合(因为文字行以大写字母开头)

.*[a-zA-Z].*

+0

试过,这是行不通的。还尝试过正则表达式'^ [A-Z]。*'和正则表达式'^ [a-zA-Z]。* $' – bevs

+0

身体是否包含一行文本或整个文本? – beny23

+0

我知道它的工作。问题是别的。谢谢你的帮助和时间。 – bevs

相关问题