[Salesforce.com] Regex too complicated

By | 6. 3. 2016

Working with the regular expressions in Salesforce.com is same as in the Java. But the regex have restrictions to its complexity. For example, this regex throws compilation error:

If you have to use multiple times the symbol * in your regex, the Salesforce.com evaluates your pattern as too complicated.

Workaround

The workaround is to use for example {0,9999} instead of *. Here is retyped first pattern, but without exception :)

Note: You can replace all asterisk. The value 9999 can be longer, for example 99999999 and everything will work in same way.

Leave a Reply

Your email address will not be published. Required fields are marked *