Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Interpolating attribute into regular expression for ExtractText Processor?

Highlighted

Interpolating attribute into regular expression for ExtractText Processor?

New Contributor

Hey Guys,

Is it possible to interpolate an attribute value into the regular expression for ExtractText processor? For example.. is it possible to rewrite the following so that Nifi accepts it? I would like to replace the placeholder ${key_value} with the attribute value for key_name...

${key_name}\s*:(\s*.+\n)


1 REPLY 1

Re: Interpolating attribute into regular expression for ExtractText Processor?

Super Guru
@Sonny Chee

If you are trying to replace the value then you can do that by using Replace Text processor instead of ExtractText processor.

Extract text processor extracts the contents of flowfile for the matching regex and keep the extracted contents as the attributes of the flowfile.

Example:-

If you are trying to find all matches for ${key_name}\s*:(\s*.+\n) in the flowfile and then replace the matches with ${key_value)

Then replacetext processor configs:-

62813-replacetext.png

Don't have an account?
Coming from Hortonworks? Activate your account here