You need to sign in to do that
Don't have an account?
mrh
REGEX syntax help
Hello all
I am trying to include a REGEX in a field validation rule to check that for a given field of length 8 chars, the value entered has the following syntax:
1st char: X
2nd char: any alpha numeric
3rd char: any alpha numeric
4th char: any alpha numeric
5th char: any alpha numeric
6th char: 0
7th char: 1
8th char: any alpha numeric
I have tried the following but its not quite there. Could anyone please suggest a solution?
NOT(REGEX(field__c, "(X\\[a-zA-Z0-9]{5}\\01\\[a-zA-Z0-9]{1})"))
Many thanks in advance.
try
NOT(REGEX(field__c, "(X[a-zA-Z0-9]{4}01[a-zA-Z0-9]{1})"))
All Answers
try
NOT(REGEX(field__c, "(X[a-zA-Z0-9]{4}01[a-zA-Z0-9]{1})"))
Great, thanks very much for your help.
Best regards,
mark
By the way I think you'll achieve the same result with:
(X\w{4}01\w{1})
since \w search for alphanumeric char
Thanks again.
Would it also be possible to include something similar when displaying the same field as as an outputText field on a display page?
i.e. for the 'rendered' attribute for the output text field, could I do something to re-use the regex again to only display the fields which have been actually completed, i.e. not the default value or blank. I've tried to do something for this using the trim function but haven't been successful. e.g.
<apex:outputText rendered="{!ISBLANK(field.Id) && TRIM(field) != 'X 01'}"value=" "/>