-3

I have this patterns:

^\s*(?=\d*(-\d*){0,2}$)(?=(\d-*){13}$).*$

allows strings like "114-4316191466" or "1144316191466" " 1144316191466". I'd like to allow whitespace also at the end. Best way to do that?

Thanks

Guy Z
  • 683
  • 3
  • 8
  • 24
  • Yes, it is :). `$` is the anchor that matches the end of the string and `\s` is matching a whitespace character. – stema May 26 '14 at 08:48

1 Answers1

1

a whitespace is \s so to allow one or more whitespaces add \s+ or \s* at the end (as you did for the beginning of the string)

user2316116
  • 6,726
  • 1
  • 21
  • 35