vendredi 16 septembre 2016

Combining regular expressions c#

I'm trying to make simple email validation by myself. And I need to combine two patterns:

1) @"^[A-Za-z0-9][A-Za-z0-9._-]+[A-Za-z0-9]@[A-Za-z0-9][A-Za-z0-9.-]+\.[A-Za-z0-9.-]+[A-Za-z0-9]$" // allows only xxxx@xxx.xx and dot is not the first or last charachter of local and domain part

2) @"^([^\.]|([^\.])\.[^\.])*$" // there must not be two or more dots in a row.

In other words, I want to add to the first regex a condition that asd.asd@asd.com is true, but asd..asd@asd.com is false.

Aucun commentaire:

Enregistrer un commentaire