-2

My pattern is

^[a-z0-9][a-z0-9\-_.]*[a-z0-9\-_]$

I want to exclude one or more consecutive periods.

1.1.1.1 -----> GOOD
1..1.1.1 ------> BAD

Thank you for your help.

devyyj
  • 1
  • 2

1 Answers1

0

If just want to avoid any occurrence of dots being adjacent to each other, try the word boundary meta escape \b.

/\b[.]\b/g

RegEx101

zer00ne
  • 41,936
  • 6
  • 41
  • 68