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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Jacco_De_Zwart
Creator
Creator

Data from MemoText with tExtractRegexFields

Hi there,

I have the following situation:

using an API call I receive an memoText field, which contains the following data (among others):

----

Locatie op de terminal

- Kade thv loods 12

Shift

- Avond

Dienst

- Ploeg B

Afdeling

- Hout, staal & metaal

Soort incident

- Bijna ongeval

Geconstateerd door? (overslaan bij ongeval met letsel)

- Niemand

-----

I want to extract the data from this field using tExtractRegexFields.

When I want to retrieve the data from 'Locatie op de terminal' I can use regex Locatie op de terminal\n.* and it will retrieve both the lines which is good. But I allso want to retrieve the lines for Shift, using Shift\n.* for regex.

How to I get both values mapped to two different output colums of the tExtractRegexFields component ?? So that outputColumn1 has the value of 'Locatie op de terminal

- Kade thv loods 12' and outputColumn2 has the value of 'Shift - Avond' and so on.

What will happen if one of the values doesn't not exist within the memotext field ? can it still be parsed ?

Hope you can help me.

Jacco

Labels (3)
5 Replies
Anonymous
Not applicable

Hi

Find a online regext tester such as https://regexr.com/, learn and test your regex. If the value does not exist, the column will has a null value output.

 

Regards

Shong

Jacco_De_Zwart
Creator
Creator
Author

shong,

 

I use regex101: build, test, and debug regex to test my regular expressions and they work.

 

What I miss is how the ExtractRegexFields component works.

 

I got it working using the regular expressions, but for every field the component returns one row.

 

So using this expression :

"(Locatie op de terminal\\s*\n.*)|(Shift\\s*\n.*)|(Afdeling\\s*\n. *)"

 

Results in three rows and not one row with three fields filled with the values

 

But reading the documentation of Talend ExtractRegexFields and seeing the example, it suggests that it delivers one row with the fields. But not in my case.

 

What can this be ?

 

Jacco

Anonymous
Not applicable

@Jacco de Zwart​, tExtractRegexFields output one row with three fields with the values, if you want to split the values to be multiple rows, use tNormalize component after tExtractRegexFields, please read the component documentation and learn this component, let me know if you have any questions.

 

Regards

Shong

Jacco_De_Zwart
Creator
Creator
Author

@Shicong Hong​ Thank for you reply. I have made some adjustments and it works now.

 

Jacco

Anonymous
Not applicable

Great, thanks for your feedback!