You need to sign in to do that
Don't have an account?

need a specific pattern to display in the field
I Have field call EIN(number type) it has to accept the 12-1234567 formate only means beginning 2 digit dash seven digit only.
how to write the logic in apex to show the error on the vf page itself please help me out.
thanks in advance.
how to write the logic in apex to show the error on the vf page itself please help me out.
thanks in advance.
There is a help article that has an implementation of using regex for validation, below is the one that I could build up, can you please try it once:
!REGEX(epin__C,"^(\\d{2}\\-\\d{7}?$"
Help article: https://help.salesforce.com/articleView?id=000334073&type=1&mode=1
This article has an implementation of using the above regex in apex:
https://www.biswajeetsamal.com/blog/how-to-use-regex-using-apex-in-salesforce/#:~:text=Regular%20expressions%20(REGEX)%20is%20a,search%20text%20using%20regular%20expressions.&text=Patterns%20are%20used%20by%20matchers,operations%20on%20a%20character%20string.
Let me know in case if there are any issues and in case if this comes in handy can you please choose this as the best answer so that it can be useful for others in the future.
Regards,
Anutej