Skip to content

Instantly share code, notes, and snippets.

@Akiyamka
Created July 7, 2018 15:18
Show Gist options
  • Select an option

  • Save Akiyamka/ac79f374f56f95c3247e683eb4b9b5ad to your computer and use it in GitHub Desktop.

Select an option

Save Akiyamka/ac79f374f56f95c3247e683eb4b9b5ad to your computer and use it in GitHub Desktop.
test url for multiple protocols
const re = /^(?:(?:https?|[\w]*):((\/\/)[\w\d]|[\w\d+])).*/gm;
// VALID
tel:+12123123123123
http://asdasdasd.com
http://ru.asdasdasd.com
https://ru.asdasdasd.com
https://123sdasdasd.com
https://123sdasdasd.com/%D1%84%D1%8B%D0%B2%D1%84%D1%8B%D0%B2%D1%84%D1%8B%D0%B2
tg://asdasd
mailto:asdasd
// NOT VALID
http://+asdasdasd.c
tel://+12123123123123
asd:/+asdasd
asd://+123asdasd
asd:///asdasdasd
asd:///!#$@!#@!#@!#!@#$#!!#
:///asdasdasd
///://asdasd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment