0

Recently, I updated my application from Angular 9 to Angular 15. After fixing most of the issues, the console throws the following error for my input pattern that has been working before the update:

Pattern attribute value /^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\/0-9]*$/ is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: //^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\/0-9]*$//v: Invalid character in character class

This is my input field:

<mat-form-field>
   <input matInput type="tel" name="phone" [(ngModel)]="phone"
          pattern="/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\/0-9]*$/" />
</mat-form-field>

What I noticed is that the building process seems to alter my pattern and adds /v at the end. Does anybody have a similar experience?

LukyFoggy
  • 519
  • 8
  • 31

0 Answers0