I need some help with a regular expression to limit the choices a user has for passing a crappy parameter for input.
For example the path looks like this:
/project/create/:category (:category is a placeholder for a parameter so I can access it in my controller)
Basically what I want to do is match the URL to one of 2 choices (offer|request) for the category. This makes any other path a user attempts do a 404 redirect, which works fine.
What would the regex need to be to only allow these choices? (offer|request)
'/\/component\/create\/(offer|request)/' – would do the trick right?
Thank you in advance
From the way you phrased your question, what you have looks good. Couldn’t you open a PHP shell and try it out, though?