My question for James would be how do you know the query string has the parameters in that exact order? Unless the query string has been hand-crafted you cannot assume the parameters will appear in any specific order. Also, your pattern doesn't handle the case where the parameters are separated by semicolons (which is a legal alternative to ampersand). In general matching against QUERY_STRING is very difficult to do in a robust manner.