-3

I have a regular expression for validating e-mail addresses in JavaScript:

^(([\w]+(.[^<>()[]\.,;:\s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$

I need to convert it to C# format.
What are the changes needed on the above JS Regex?

Pedro Gaspar
  • 777
  • 8
  • 35

1 Answers1

0

@"^[\w!#$%&'+-/=?\^_{|}~]+(\.[\w!#$%&'*+\-/=?\^_{|}~]+)" + "@" + @"((([-\w]+.)+[a-zA-Z]{2,4})|([([0-9]{1,3}.){3}[0-9]{1,3})]|(([0-9]{1,3}.){3}[0-9]{1,3}))$"

Got this regex perfectly suits my requirements. Which allows IP addresses with or without [] enclosed