Skip to content

Instantly share code, notes, and snippets.

@asciant
Created January 2, 2017 03:41
Show Gist options
  • Save asciant/90e7d268da1e85be6856413f03ee3f75 to your computer and use it in GitHub Desktop.
Save asciant/90e7d268da1e85be6856413f03ee3f75 to your computer and use it in GitHub Desktop.
RegEx Validator angular
emailRegex = /^[a-z0-9!#$%&'+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-][a-z0-9])?(.a-z0-9?)*$/i;
registration : FormGroup;
constructor(r: FormBuilder, public http :Http){
this.registration = r.group({
'chosen_username' : [null, Validators.required],
'chosen_email' : [null, Validators.pattern(this.emailRegex)],
'chosen_password' : [null, Validators.required],
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment