I'm using the following code to split incoming requests:
/*
* Create global $GET from our cool URL's
*/
preg_match_all('/[\/|\?|\&]([a-zA-Z\_0-9]+)([\/|=]([0-9]+)){0,1}/', $_SERVER['REQUEST_URI'], $parts, PREG_PATTERN_ORDER);
if( count($parts[1]) >= 1 && count($parts[3]) >= 1)
$GET = array_combine($parts[1], $parts[3]);
URL's like "/cat/2/post/345/answer/post" is divided into:
cat => 2
post => 345
answer =>
post =>
is it possible to change this regex to allow for urls like: /post/345-title-goes-here/ and make it into:
post => 345-title-goes-here
becasue right now it only works if the argument is strictly 0-9 with no other characters. and even that was a real problem for me. any suggestions? :)
#[/?&]([\w.()-]+)([/=](\d[\w.()-]+|\d))?#