Created on 01-18-2020 11:51 AM - last edited on 01-18-2020 06:36 PM by ask_bill_brooks
Hi, I have a flowfile with this format:
<td>Item1</td>
<td class="dest">50.3421</td>
<td class="dest">20.5547</td>
I need to write a query with the parameters, so I need to extract the numbers, with this for example:
(\d{2}.\d{4})
And put the 2 resultos in:
Insert into table(a,b) VALUES($1,$2)
How can I do this?
Thanks!
I tryed with replaceText but it's not what im looking for
Created 01-22-2020 01:59 PM
You can accomplish this use ReplaceText with a more complex Java regular expression.
The Replace Text is designed to replace every occurrence of the string matched by your java regular expression with the replacement value. So you are probably seeing your replacement value inserted into your existing content twice.
Try using the following java regular expression which will match your entire 3 lines of content:
.*\n.*?(\d{2}.\d{4}).*?\n.*?(\d{2}.\d{4}).*
Leave your replacement value as you already have it and make sure you have Evaluation mode still set to Entire text.
Hope this helps,
Matt
Created 01-20-2020 10:01 AM
The first thing that comes to mind is the Extract Text processor. It allows you to get (multiple) parts from the text and put it into attributes.
org.apache.nifi.processors.standard.ExtractText
Created 01-22-2020 01:59 PM
You can accomplish this use ReplaceText with a more complex Java regular expression.
The Replace Text is designed to replace every occurrence of the string matched by your java regular expression with the replacement value. So you are probably seeing your replacement value inserted into your existing content twice.
Try using the following java regular expression which will match your entire 3 lines of content:
.*\n.*?(\d{2}.\d{4}).*?\n.*?(\d{2}.\d{4}).*
Leave your replacement value as you already have it and make sure you have Evaluation mode still set to Entire text.
Hope this helps,
Matt