I'm trying to update an attribute (for example let's call it myAttribute) in order to replace all " by \" for example:
for that purpose I'm using the updateAttribute procesor with the replaceAll function for example:
the result is the same (\ is used as escape sequence prefix) I tried to use also two \\ but the result is the same.
Someone can help me?
Well, it seems like there's a bug in the replaceAll
function of the expression language..
But anyways, it seems like you're trying to escape your Json which escapeJson
would solve..
So instead, just use ${log.message:escapeJson()}
Probably escapeJson
is the best option but if you need to do it with replaceAll
, try this:
${log.message:replaceAll("\"","\\\\\"")}
or
${log.message:replaceAll('"','\\\\"')}
I've tested with NiFi 1.9.0 and it works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.