I am trying to validate the phone number using regular expression in angular. Using a regex from this reference Regex Ref which suites my requirements.
The regex in the controls pattern is not working, getting this error Cannot read property 'get' of undefined -
this.userForm = this._formBuilder.group({
    firstName: new FormControl('', [
        Validators.required,
        Validators.pattern('^[a-zA-Z ]{1,30}$')
    ]),
    lastName: new FormControl('', [
        Validators.required,
        Validators.pattern('^[a-zA-Z ]{1,30}$')
    ]),
    email: new FormControl('', [
        Validators.required,
        Validators.pattern(
            '[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\\.[a-z]{2,3}'
        )
    ]),
    phoneNumber: new FormControl('', [
        Validators.required,
        Validators.pattern(
            '^(+d{1,2}s?)?1?-?.?s?(?d{3})?[s.-]?d{3}[s.-]?d{4}$' // not working
        )
    ]),
    notes: new FormControl(''),
})
