Add an Escape function to the Text extension

By Rui Lopes on 23 Jun 2017


In order to build correct regular expressions, it is often necessary to escape reserved characters in the string to be searched. This is especially true when the string comes from a user-generated input (for example, the name of an email attachment). 

For this, the following C# method can be used:

  • Regex.Escape(String)

A similar method probably exists for the Java stack.



Hi Rui.

I have created a forge component with that action:

The component does much more than that, but the action is RegexEscapePattern, and it works in Java too!