Skip to main content
Mikkkk
Bronze ⭐️⭐️⭐️
October 23, 2024
Question

NiFi Apache - how to remove punctuation from a single column

I am trying to remove the punctuation from a single column using the UpdateRecord processor.  But I am unable to get it right. I attached screenshots of my configurations and properties. 

Screenshot 2024-10-23 143224.pngScreenshot 2024-10-23 143255.pngScreenshot 2024-10-23 143324.pngScreenshot 2024-10-23 143414.png

 

 

3 replies

DianaTorres
Community Manager
Community Manager
October 23, 2024

@Mikkkk Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our NiFi experts @steven-matison @joseomjr  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.

Translate
Regards, Diana Torres, Senior Community Moderator
drewski7
Gold ⭐️⭐️
October 24, 2024

@Mikkkk 

Please check my screenshot below. I changed the "Replacement Value Strategy" property to "Literal". I also updated the dynamic user property to this  - ${field.value:replaceAll('[\\p{Punct}]', ' ')}

Here's the screenshot - 

drewski7_0-1729735113745.png

 

${field.value}: In NiFi’s Expression Language, field.value refers to the current value of the field being processed in a record (for example, the value of the ENTITY_NAME field if that’s what you’re working on).

:replaceAll('[\\p{Punct}]', ' '): This function searches the field.value for any punctuation characters (using the [\\p{Punct}] regex) and replaces each occurrence with a space.

 

Please "Accept the solution" if it helped!

Translate
DianaTorres
Community Manager
Community Manager
October 29, 2024

@Mikkkk Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.  Thanks.

Translate
Regards, Diana Torres, Senior Community Moderator