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

Need help on REGEX
Help on REGEX
In Visualforce Javascript Function we have a email Regex as Below:
var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; This is helpful for email format.But now the Problem is if users enter spaces or any character at first iit should not allow.Means first 2 characters should be either a-zA-Z0-9.I created a seperate Regex as var textRegex = /^[a-zA-Z0-9]{2}/; It is working for other Text fields but for this email field it is not throwing error ,Please some one explain how to achieve this
Thanks in advance
In Visualforce Javascript Function we have a email Regex as Below:
var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; This is helpful for email format.But now the Problem is if users enter spaces or any character at first iit should not allow.Means first 2 characters should be either a-zA-Z0-9.I created a seperate Regex as var textRegex = /^[a-zA-Z0-9]{2}/; It is working for other Text fields but for this email field it is not throwing error ,Please some one explain how to achieve this
Thanks in advance
If you really want to go down the regex path see How can we check that an email address is in a valid format? (https://help.salesforce.com/articleView?id=000170904&language=en_US&type=1)