#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2018
    Posts
    3
    Rep Power
    0

    Regular expression for email validation in CLR(C#.net) programming in SSIS


    I have a requirement in CLR(C#) programming in SSIS to validate email address with below rules: I have the regex in PHP that I need to convert it into CLR(C#) code.

    1.Must have one and only one (1) @ symbol

    2.Must have only letters, numbers, dashes - or dots . after the @ symbol

    3.Must have 2 parts on either side of the dot . i.e. @a.b is valid or @hotmail.com or @gmail.com but a. or ..b are not valid

    4.Must have 2 parts on either side of a dash - i.e. a-b is valid but a- or -b is not valid

    5.It can be any character before @.

    The regular expression in PHP is:

    @0-9A-Za-z(.0-9A-Za-z)+

    Can someone please advise on how to do this?
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,797
    Rep Power
    9646
    PHP regular expressions are 99% compatible with .NET. What you're trying to do will work without changes. However, the "regex" you posted is most definitely not correct, so you'll have to fix that.

IMN logo majestic logo threadwatch logo seochat tools logo