Skip to content

Instantly share code, notes, and snippets.

View sacarino's full-sized avatar

Shane sacarino

View GitHub Profile
@sacarino
sacarino / regex.txt
Last active March 18, 2017 03:45
Incredibly useful regex for URL parsing
(http[s]?:\/\/)?([^\/\s]+)\/?([^\/\s]+)\/(.*)\?(.*)\#(.*)\b
example here: https://regex101.com/r/QJdP9m/1
Full match: https://www.somehost.com/path/that/you/can/target?query=butwhy#because
Group 1: https://
Group 2: www.somehost.com
Group 3: path
Group 4: that/you/can/target
Group 5: query=butwhy