Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi All
I have the following code
VB
Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
      Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
      Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
      If emailAddressMatch.Success Then
          EmailAddressCheck = True
      Else
          EmailAddressCheck = False
      End If
  End Function



where I have to allow ' character to email.What should I do? Please help
Posted

 
Share this answer
 
VB
Try this on.
^\w+([-+.']\w+)*@\w+([-.']\w+)*\.\w+([-.]\w+)*$


VB
Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
      Dim pattern As String = "^\w+([-+.']\w+)*@\w+([-.']\w+)*\.\w+([-.]\w+)*$"
      Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
      If emailAddressMatch.Success Then
          EmailAddressCheck = True
      Else
          EmailAddressCheck = False
      End If
  End Function
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900