adding apostrophe while checking email address
I am new to regular expression. I want to allow an apostrophe (') to be allowed while validating email address. I have a regular expression as one given below:
private static Regex emailRegex = new Regex(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" 开发者_如何学Go+
@".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
What changes should i have to do in the above regex to allow (')?
private static Regex emailRegex = new Regex(@"^([a-zA-Z0-9\'_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
@".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
精彩评论