Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Match Regular expression with tFilterRow

Hi
I tried to use advanced settings of tFilterRow to filter dataflow with regexp, but lacking java knowledge stopped me 0683p000009MACn.png
Could someone paste a sample java code for matching with regexp?
Thanks in advance
Labels (3)
11 Replies
_AnonymousUser
Specialist III
Specialist III
Author

I have a similar question to Ruben, I need to have regex expressions in tFilterRow to filter out invalid data type entries from a CSV file.
Thanks for your help.
Zohaib
Anonymous
Not applicable

hi all,
Have a look at api java regex for matches method !
hope it help
laurent
_AnonymousUser
Specialist III
Specialist III
Author

Kzone,
I'm a newbie to Talend. Could you please let me know where can I write the code that you suggested for the CLASS.
An screenshot or a sample would be of great help.
Thanks a lot,
Zohaib
Anonymous
Not applicable

hi Zohaib,
in fact it's pretty simple.
For example let's match for compliance mail ! (a classic).
In the 'advanced mode' write your condition with the convinience method matches. it does the work for you 0683p000009MACn.png
first arg : your regular expression
second arg : string to be parse
the method return boolean
For 'true' goes into filter flow ; when 'false' goes into reject flow.
Right, in my example all email are correct; made one wrong and it goes in reject ...
now you have to write your regex 0683p000009MA9p.png
hope it help
regards
laurent
_AnonymousUser
Specialist III
Specialist III
Author

Thanks Kzone!
Anonymous
Not applicable

you welcome 0683p000009MA9p.png
_AnonymousUser
Specialist III
Specialist III
Author

Hi I am wondering how to ignore or filter out some data from Input file.
I have columns with no data. and they need to be filtered in the out put file.
How to use TFilterRow ?
Anonymous
Not applicable

Hi I am wondering how to ignore or filter out some data from Input file.
I have columns with no data. and they need to be filtered in the out put file.
How to use TFilterRow ?

Yes, tFilterRow or tMap component can used to do the filter.
Best regards
Shong
_AnonymousUser
Specialist III
Specialist III
Author

Hi ,
I tried to use the advance mode in the tFilterRow to use a regex .
here is the regex : input_row.etab.matches("\"12206\"|\"12906\"|\"16006\"") (i also tried without the \ )
heres is the data I wont to filter :12206 - CR22
12906 - CR29
13306 - CRAQ
13606 - CRIV
14445 - CEBPL
14706 - CRAV
16006 - CR56
16275 - CENFE
17906 - CRAM
18025 - CEPIC
19406 - CRTP

at the end i should have the row with
12206 12906 et 16006.
Instead I got nothing .
What did I miss ??
PS , I also tried : java.util.regex.Pattern.matches("12206|12906|16006", input_row.etab) and got the same results.