0
中字符类的范围出错我试图验证使用表达式^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$
的电子邮件输入字段,但它会抛出错误Range out of order in character class at RegExp
。如何验证使用表达RegExp
ngOnInit() {
// created FormGroup using FormBuilder
this.courseForm = this.fb.group({
username: [null, [Validators.required, Validators.pattern('^[a-z0-9_-]{3,16}$')]],
email: [null, [Validators.required, Validators.pattern('^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$')]],
address: (null),
select: (null)
});
为什么你必须这样做。我可以在哪里了解更多信息 – SONGSTER