I'm pretty close from what I want to achieve.
I have this :
'/create-group/([A-Za-z0-9\-\_]+)(?:/([A-Za-z0-9\-\_]+))?(?:(\?|&)(groupid|copyofgroup|ref)=([A-Za-z0-9\-\_]+))?'
It allows me to restrain what URIs can be typed in and accessed, such as:
/create-group/123/456?groupid=789
In the last bit of the regex, I allow 3 parameters (groupid, copyofgroup and ref).
This is all good, but I can't figure out a way to have my preg_match validate an infinite number of these 3 parameters. Right now, I'm only limited to 1 instance of a parameter.
I'd like my preg_match() to accept :
/create-group/123/456?groupid=789&ref=101112©ofgroup=789
I've tried multipliers such as * and +, but to no avail.
Thank you!
$_GET,$_POSTor$_REQUESTsuperglobals?[A-Za-z0-9\-\_]with[[:alnum:]_-]. Characters lose their specialness inside square braces, so you don't need to escape things with backslashes, and a dash at the either end means a dash rather than a range delimiter. And character classes just make sense.$_GETthe needed parameters from the URI string and ignore the rest instead of crutching your way through the code.