0

Required regex pettern like

  1. allow only letters with min 1 dot and maximum 3 dots.
  2. allow optional as '-' special character.

Ex: raj.gopal-reddy or raj.reddy.gopal

4

1 回答 1

0

您当前的正则表达式处于正确的轨道上,我会使用否定的前瞻来断言不会出现三个以上的点。考虑这种模式:

^(?!.*\..*\..*\..*\.)[A-Za-z-]*\.[A-Za-z-]*$
于 2019-05-28T06:44:05.897 回答