Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Regex # Special Character Escape

avatar

I'm trying to use regex to match the line:
# DOG CAT BIRD

NiFi regex seems to treat # as a comment character, whereas other regexes do not.

How do I match the literal character # in a string with regex?


The doc page https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#escaping doesn't seem to help me out here.

1 ACCEPTED SOLUTION

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
4 REPLIES 4

avatar
Contributor

Did you try using '\' character?

avatar

With the '\' character, the '#' character still highlights the text after it as a comment:

108373-1556809188675.png

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar

Thanks Matt, I didn't realize that the colored text was not a comment in this case.