function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abc234Abc234 

validations on text

i have filed named PAN CARD with length 10, so i need to validate that filed with below requirment

 

1st 5 characters should be alphabets, next 4 characters are numbes and 10 place should be alphabet

 

for  example :

 

AIEPV4202F

 


sfdcfoxsfdcfox
NOT(REGEX(FieldName__c,"^\\w{5}\\d{4}\\w$"))

Use this as a validation rule on your object, replacing FieldName__c with the name of the field, as appropriate.

Abc234Abc234

NOT(REGEX( PAN_Number__c__c ,"^\\w{5}\\d{4}\\w$"))

When I use this am getting below error

Error: Incorrect argument type for function 'REGEX()'.

 

 

Instead of I used NOT( REGEX( PAN_Number__c , "[A-Za-z]{5}[0-9]{4}[A-z]{1}") )--it's working for me

yvk431yvk431

the basic issue i observed is you entered the api name  incorrectly in the REGEX provide by SFDC Fox, but gave it correctly in the second REGEX, api name will never consists a __c twice.

 

 

--yvk

Abc234Abc234

i have entered API name correctly both REGEX But while replying to your comments i have written  api name __c twice in 1st REGEX its my typo 

 

Regards,

Bharath