Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save daGrevis/9762288 to your computer and use it in GitHub Desktop.

Select an option

Save daGrevis/9762288 to your computer and use it in GitHub Desktop.
Will match 99% URLs
/
(?:(\w+)\:?\/\/)? # Protocol
([^\/?]+) # Optional subdomains, domain and TLD
\/? # Traling slash
([^\?]*) # Path
([^\#]*) # Query
(\#?.*) # Fragment
/xu
# http://regex101.com/r/oV5tN9
@daGrevis
Copy link
Author

99% is a made up number! 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment