• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] RegEx - cut out string

#1 2011-05-19 00:18:32

mykey_b
Member
Registered: 2011-04-13
Posts: 11

[resolved] RegEx - cut out string

Hi there. I need some command for RegEx.
The pattern seems to work but there's still some little error

my inputfile looks like this:

09.05.2011 00:10:00 493.8
#stop
#start
#COV from CW 0.0
10.05.2011 00:10:00 493.9

Pattern:

"^"+
"([0-9]{2}\\.[0-9]{2}\\.[0-9]{4})"+
"[\\s|\\t]+"+
"([0-9]{2}:[0-9]{2}:[0-9]{2})"+
"[\\s|\\t]+"+
"([0-9\\.\\,\\-]+)"+
".*"

output is:

Line doesn't match: #stop
Line doesn't match: #start
Line doesn't match: #COV from CW 0.0
.----------+--------+-----.
|       tLogRow_11        |
|=---------+--------+----neutral
|date      |time    |value|
|=---------+--------+----neutral
|09.05.2011|00:10:00|493.8 |
|10.05.2011|00:10:00|493.9 |
'----------+--------+-----'

what i want is to ignore, leave out, skip or s.th. like this on the strings
"#stop"
"#start"
"#COV from CW 0.0"

I'm workin on T.O. 4.2 - java

can s.o. help me out with the command?

thank you very much
Maik

Offline

#2 2011-05-19 09:01:41

shong
Talend team
Registered: 2007-08-29
Posts: 10297
Website

Re: [resolved] RegEx - cut out string

Hi Maik
Just an idea, remove the lines starts with # from source file before use regex component to read the file. For example:
tFileInputFullRow--main-->tFilterRow--tFileOutputDelimited(generate a temp file)
  |
onsubjobok
  |
tFileInputRegex(read the temp file)--main-->tLogRow
  |
onsubjobok
  |
tFileDelete(delete the temp file if needed)

on tFilterRow, check the box 'use advanced module' and input the code:
!input_row.line.startsWith("#")


Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2011-05-21 22:47:03

mykey_b
Member
Registered: 2011-04-13
Posts: 11

Re: [resolved] RegEx - cut out string

Thank you very much for this solution!

It works great !!!

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] RegEx - cut out string

Board footer

Powered by FluxBB