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
Revati BhavsarRevati Bhavsar 

Pattern matching

I am writing a class to do pattern matching for checking whether the user entered pan number is valid or not.This pan number is a field of a custom object.Please help me how should I fetch this object and perform pattern matching.

Thanks in advance!!!
Carlos Campillo GallegoCarlos Campillo Gallego
Hi Revati,

You don't need to create an Apex class to validate a pattern, you can use just a validation rule and a REGEX expression.
This link [1] should be helpful for you.

Regards,

[1]
https://help.salesforce.com/apex/HTViewSolution?id=000213868&language=en_US
Carlos Campillo GallegoCarlos Campillo Gallego
Also, check this link [2] in order to learn more about Validation Rules, you'll find some common examples in it.

[2]
https://developer.salesforce.com/docs/atlas.en-us.usefulValidationRules.meta/usefulValidationRules/fields_useful_validation_formulas_other.htm