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:
1 |
([a-zA-Z]*_*)*\.([a-zA-Z]*_*)*\.[0-9]* |
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 :)
1 |
([a-zA-Z]*_*)*\.([a-zA-Z]*_*){0,9999}\.[0-9]{0,9999} |
Note: You can replace all asterisk. The value 9999 can be longer, for example 99999999 and everything will work in same way.