[Vuejs]-How to format a phone number in regex using [Vue 2]

1๐Ÿ‘

/^\+?[0-9]+$/g
  • ^ asserts position at start of a line
  • \+ matches the character +
  • ? matches the
    previous token between zero and one times
  • Match a single character present in the list [0-9]
  • + matches the previous token between one and unlimited times
  • $ asserts position at the end of a line
  • /g Global modifier, return all matches
๐Ÿ‘คSani Huttunen

Leave a comment