Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^((ftp|http)s?:\/\/)?[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?$
/
gm

Description

found in https://stackoverflow.com/a/14720951/10715454

check string for absolute url (with domain and such)

true

false

  • /asdasd/asdasd.asdasd
  • sadsad/adsada
  • sadadasd/asdad
  • example.com/asdasadsdsad.
Submitted by https://stackoverflow.com/users/114251/arun-p-johny - 6 years ago