I am trying to validate phone number in the reactive form validation. but reg expression not working properly. Getting error like below:
ERROR Error: Invalid regular expression: /^/^+([0-9]{1,3})?[- ]?(d{3})?[- ]?(d{3})[- ]?(d{4,6})( ext d{4})?$/$/: Nothing to repeat
Demo: https://stackblitz.com/edit/angular-g7vtuj-onr6bz?file=app%2Fselect-multiple-example.ts
You should remove the extra forward slashes / at the beginning and end of the regular expression pattern. Also there is a typo in the regular expression; \d should be used instead of d for digit matching.
I hope it helps.