Regular Expression for $_GET query strings
- by sandelius
Hi there!
I'm trying to find a regular expression for $_GET query strings.
I have an array like this:
private $_regexp = array(
':id' => '[0-9]+',
':year' => '[12][0-9]{3}',
':month' => '0[1-9]|1[012]',
':day' => '0[1-9]|[12][0-9]|3[01]',
':slug' => '[a-zA-Z0-9-]+',
':query' => '...'
);
and I loop throw them to see if I have a matching wildcard like this:
if ( array_key_exists($matches[0], $this->_regexp) )
{
return '^('.$this->_regexp[$matches[0]].')$';
}
All other regexp go throw but I've tried a whole lot of different regexp to find:
?anything=anything
can't figure it out, googled like h..l but can't find anything. I've tried, for example something like this:
(\?)(.*)(=)(.*)
but without result...
Any regexp gurus here?
/ Tobias