I am working in angular 7 and validating contact number using
"^(?!(\d)\1+$)(?:\(?\+\d{1,3}\)?[- ]?|0)?\d{10}$"
regular expression but it is throwing the following error : Module parse failed: Octal literal in strict mode (10:76)
I have already tried \\
instead of \
because as per my finding the problem is with \
character.
registerForm = this.fb.group(
{
email:['', [Validators.required, Validators.pattern('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+.com$')]],
contact:['',[Validators.required, Validators.pattern('/^(?!(\d)\1+$)(?:\(?\+\d{1,3}\)?[- ]?|0)?\d{10}$/')]],
password:['',[Validators.required]],
confirmPassword:['',[Validators.required]]
},{ validator: PasswordMatchValidator });
Is there any way to replace \
character to make it work?