I am using a regular expression to separate elements of a url:
http://domain.com/page/post#fragment?query
/(?:([\w\-\+]+(?<!domain\.com))\/?)?(?:([\w\-\+]+(?<!domain\.com))\/?)?(?:#([\w\-\+]+))?(?:\?([\w\-\+]+))?$/
Here would be the results of this match:
$1 = page
$2 = post
$3 = fragment
$4 = query
I am getting this error:
Invalid regular expression: /(?:([\w\-\+]+(?<!localhost))\/?)?(?:([\w\-\+]+(?<!localhost))\/?)?(?:#([\w\-\+]+))?(?:\?([\w\-\+]+))?$/: Invalid group