- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Extract Text - Extracting delimited data
- Labels:
-
Apache NiFi
Created ‎07-12-2017 06:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All,
I am trying to extract data using ExtractText such that
Original Text = T03%%350%%11502998%%2151%%3312,56%%3
String.1 = T03
String.2 = 11502998
How can I do that using ExtractText?
Also, can someone please guide me to good resources ( website, blog etc.) so that I can parse such trivial strings by myself in future? 🙂
Created on ‎07-12-2017 07:17 PM - edited ‎08-18-2019 01:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I find the following very useful when trying to build Java regular expressions:
The Java regular expression:
^(.*?)%%(.*?)%%(.*?)%%(.*?)%%(.*?),(.*?)%%(.*?)$
It has 7 capture groups that will result in:
When you add a ew property to the extractText processor with a property name of "string" and use the above java regex.
Of course if you are only looking for two capture groups, you could use the following regex instead:
^(.*?)%%.*?%%(.*?)%%.*?%%.*?,.*?%%.*?$
Thanks,
Matt
Created on ‎07-12-2017 07:17 PM - edited ‎08-18-2019 01:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I find the following very useful when trying to build Java regular expressions:
The Java regular expression:
^(.*?)%%(.*?)%%(.*?)%%(.*?)%%(.*?),(.*?)%%(.*?)$
It has 7 capture groups that will result in:
When you add a ew property to the extractText processor with a property name of "string" and use the above java regex.
Of course if you are only looking for two capture groups, you could use the following regex instead:
^(.*?)%%.*?%%(.*?)%%.*?%%.*?,.*?%%.*?$
Thanks,
Matt
Created ‎07-19-2017 04:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Matt. 🙂
