Home > Mobile >  NiFi regular expression for Update Attribute doesn't work
NiFi regular expression for Update Attribute doesn't work

Time:06-17

So I wanna replace all | ' " symbols in attribute. But this statement doesn't work at all, it literally puts this text into value of attribute

${attribute:replaceAll('[\||'|"]', ' ')}  

I have suspicions that it has something to do with quotes, but i have no idea how to fix it.

CodePudding user response:

I believe since the delimiters are single quotes you'd need to either choose different ones, or escape the single quote you are trying to remove. Since [] creates a character class I shouldn't need to | each character either. This should work:

${attribute:replaceAll('[|\'"]', ' ')}

  • Related