I have the following situation in Salesforce: A certain fields contains one string. But this string char's all have a significant meaning.
For instance, the string can look like: GHJKL where G, H, J, ... have a certain meaning which is being used in code.
What I would like to do now is perform a Validation on the entered String with following conditions:
Only the chars: GHJKL can be entered
The char G AND/OR H must be entered at east once
I have following REGEX which detects that only the above chars can be entered:
For the first Validation:
'NOT(REGEX(CustomFieldName__c,"[ABCDEI]{0,30}"))'
For the Second Validation:
'NOT(REGEX(CustomFieldName__c,"[DE]{1,}"))'
But the second validation seems not be working. I've tested the Regex using online Regex tester where this seems to be working. But on Salesforce, the regex is constantly providing a False.
Any ideas?
Thanks!
This should be regex for second validation for You
(?=.*D)(?=.*E).*|[DE]+
Thanks to Regex AND operator