Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 07-03-2019 11:32 AM
If i use an extract text processor to extract a key and value from a text, then i always get 2 attributes with the same value.
For example:
If i use test: ([\w .]+) as my expression, then when i process a file with content "test: me" then the single data capture produces two attributes which as far as i can see are exactly the same.
myattribute : "me"
myattribute.1 : "me"
Is there any way i can configure this to get just 1 attribute? Or is there a better way to extract key= value data from a file content?
eg. attribute1:500, attribute2:600
Many thanks in advance.
Created 07-04-2019 03:09 AM
From NiFi ExtractText docs:
The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided.
This is an expected behaviour from NiFi as you are having capture group in your regular expression, so extract text processor adds index value to attribute name.
For consistency use ${myattribute} without index value as the reference for the attribute value.
-
If the answer is helpful to resolve the issue, Login and Click on Accept button below to close this thread.This will help other community users to find answers quickly 🙂
Created 07-04-2019 03:09 AM
From NiFi ExtractText docs:
The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided.
This is an expected behaviour from NiFi as you are having capture group in your regular expression, so extract text processor adds index value to attribute name.
For consistency use ${myattribute} without index value as the reference for the attribute value.
-
If the answer is helpful to resolve the issue, Login and Click on Accept button below to close this thread.This will help other community users to find answers quickly 🙂
Created 07-04-2019 12:32 PM
Thanks for your help!