regex url parser

/^((http[s]?|ftp):/)?/?([^:/s]+)(:([^/]*))?((/w+)*/)([w-.]+[^#?s]+)(?([^#]*))?(#(.*))?$/gi

schema = 2,
domain = 3,
port = 5,
path = 6,
file = 8,
querystring = 9,
hash = 12

source

Comments are closed.