Home > Net >  Regex for string that can contain periods but not two in a row?
Regex for string that can contain periods but not two in a row?

Time:10-16

This page lays out the rules for making a Gmail address: https://support.google.com/mail/answer/9211434?hl=en

Usernames can be 6-20 chars and can contain any number of periods, so long as they don't start or end the string, and that there are no two in sucession. I am new to Regex and I have no idea how to specify this, or what to search for to find out. Any help would be appreciated!

CodePudding user response:

This pattern: ^((?!\.\.).)*$ will NOT match strings with double dots.

Edit: But it will include strings with a single .

  • Related