Question
How to filter special characters in content without removing the hyphen (-) and backslash (\) in the RIH recipe ?
Answer
We need to use the ruby code in the recipe and use the below code within the ruby code to get the hyphen (-) and backslash (\)
{ Cleanse_Output: input["Cleanse_Input"].gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/, "").gsub(/[^a-zA-Z0-9 &\/\\'ñÑáéíóúÁÉÍÓÚüÜäöüÄÖÜàèìòùÀÈÌÒÙßâêîôûÂÊÎÔÛçÇãõÃÕœŒ\-]/, "").gsub(/^\s+|\s+$|\s(?=\s)/, "").capitalize.humanize.gsub(/\b('?[a-z])/) { $1.capitalize } }
Example :
The input content: "30-11 Z `!#$%^&*()_+=[]\;,. \Room"
After using the ruby code the output content is: "30-11 Z & \Room"
Comments
Please sign in to leave a comment.