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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
richie1985
Contributor
Contributor

regex match new line doesnt work

hi,

 

want to to match a line from a text file:

 

0683p000009M33Q.png

in a tJavaRow:

output_row.line = input_row.line;
String regex = "\\d{7}\\n";
java.util.regex.Matcher m = java.util.regex.Pattern.compile(regex).matcher(input_row.line);
   if(m.find()){
      System.out.println(m.group(0).trim().substring(0,7));
   }

this "\\n" doestn match the "LF", what could i do?

 

Labels (3)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

Hi,

 

it is because - if you (as usual) read file row by row, Talend already truncate this LF from the line (default line separator)

but if you test with tInputFileRow (don't forget to convert it to string) - regex will work

View solution in original post

2 Replies
vapukov
Master II
Master II

Hi,

 

it is because - if you (as usual) read file row by row, Talend already truncate this LF from the line (default line separator)

but if you test with tInputFileRow (don't forget to convert it to string) - regex will work

richie1985
Contributor
Contributor
Author

awesome! thank you!