You need to sign in to do that
Don't have an account?
sanjusfdc
code for email validation emailRegex in apex
Hi
I have tried below code for email validation:
String emailRegex = '^[a-zA-Z0-9_|\\\\#~`=?$^!{}+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z]{2,4}$';
valid email is like sanju.test@test.com should be accetable.
how to write code for below condition
1. Number of characters before @ should be equal or less than 64 characters
2. Below character should NOT be acceptable.
".@"
"@."
3. First and Last character should NOT be "."
Thank you in advance
I have tried below code for email validation:
String emailRegex = '^[a-zA-Z0-9_|\\\\#~`=?$^!{}+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z]{2,4}$';
valid email is like sanju.test@test.com should be accetable.
how to write code for below condition
1. Number of characters before @ should be equal or less than 64 characters
2. Below character should NOT be acceptable.
".@"
"@."
3. First and Last character should NOT be "."
Thank you in advance
Hi Sanju,
Salesforce provide email data-type field, which itself have email regex functionality.
Still if you need custom regex please go through this link: https://help.salesforce.com/articleView?id=000170904&language=en_US&type=1
Thanks,
Gaurav