Support Questions
Find answers, ask questions, and share your expertise

Interpolating attribute into regular expression for ExtractText Processor?

Explorer

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

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