Created 04-06-2018 12:19 PM
I have tried replceText processor to remove first 5 letters but it doesn't work..Please suggest me the best way to remove first 5 letters in NiFi
Created on 04-06-2018 12:37 PM - edited 08-17-2019 10:09 PM
Try with below configurations of Replace Text processor:-
Search Value
^.{0,5}
Replacement Value
Empty string set
Character Set
UTF-8
Maximum Buffer Size
1 MB
Replacement Strategy
Regex Replace
Evaluation Mode
Entire text
Input Flowfile Content:-
https://community.hortonworks.com/questions/182384/how-to-remove-just-only-5-characters-from-url.htm...
Output Flowfile Content:-
we are removing first 5 characters and replacing them with empty string, as you can see below we have removed https(first 5 characters).
://community.hortonworks.com/questions/182384/how-to-remove-just-only-5-characters-from-url.html
.
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
Created on 04-06-2018 12:50 PM - edited 08-17-2019 10:09 PM
if you are having url as attribute to the flowfile then you can use update attribute processor with replaceFirst function to replace 5 characters with empty string.
Example:-
I'm having url attribute to the flowfile with value as
https://community.hortonworks.com/questions/182384/how-to-remove-just-only-5-characters-from-url.htm...
Now i'm using update attribute processor and added new property in update attribute processor
url
${url:replaceFirst('\w{5}', '')}
(or)
${url:replaceAll('^.{0,5}', '')}
Output Flowfile Attribute value:-
Now we have removed first 5 characters in url attribute value by using update attribute processor.