Skip to content

Instantly share code, notes, and snippets.

@pirey
Last active December 30, 2016 08:04
Show Gist options
  • Save pirey/1b3ebfd20d19576196121bfc0e4c5cb3 to your computer and use it in GitHub Desktop.
Save pirey/1b3ebfd20d19576196121bfc0e4c5cb3 to your computer and use it in GitHub Desktop.
Simple domain name filtering
# including any dots
/^[^\w\d]+|-(?<!\w)+|[^\w\d\.-]+|\s+|_+|[^\w\d]+$/
# match any dots except the last dot before tld
/^[^\w\d]+|-(?<!\w)+|\.(?!\w+$)|[^\w\d\.-]+|\s+|_+|[^\w\d]+$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment