Regular expression for query parameters

Is it somehow possible that excluding query parameters can be defined by using regular expressions?

We are using Liferay, a highly dynamic portal with cms which is capable to host multiple websites. Somehow this portal software also dynamically generates query parameters. For example one query parameter can be:


So it would be handy if you can exclude this parameter with a regex like:


It’s not possible but we could build this feature, if you can sponsor it

I would love to sponsor piwik in any way by contributing code, but i am struggling with dev enviornment. Can you point me to some usefull tips and what IDE/configuration i should use?

Hi all, I have created the following code to use the * wildcard in the query parameter exclude form. The function is built-in in the ~/core/Tracker/Action.php file, just above function getQueryStringWithExcludedParameters();

        *  Returns a Boolean, true or false
        *  Given is an array with input parameters, which elements may contain the * wildcard and a reguested queryparameter
        *  @static
        *  @param $queryParameter
        *  @param $parametersToExclude
        *  @return boolean
        *  author: stippy
        *  date: 2012-11-12
        public static function checkForQueryStringMatch($queryParameter, $parametersToExclude)
                //loop trough each element of parametersToExclude array
                foreach( $parametersToExclude as $excludedParameter  ){

                        //include proper start and end match for regex

                        //check if a wildcard is present, if yes, generate regex for wildcard *
                        if ( preg_match('/\*/',$excludedParameter) ){
                                //replace wildcard * with a valid regex
                                $excludedParameter=str_replace('*', '.*', $excludedParameter);


                        //check if there is a match between the given queryParameter and parametersToExclude array
                        if( preg_match($excludedParameter, $queryParameter)){
                                //one match found, finish this function by returning true
                                return true;
                //not even one match, return false
                return false;

On more adjustment should be made in the code, in function getQueryStringWithExcludedParameters

if (!in_array(strtolower($name), $parametersToExclude))

should be replaced with:

if (!self::checkForQueryStringMatch(strtolower($name), $parametersToExclude))

I would appreciated any comments. I could already tell that this may not be the most fast solution. There is now a big difference in the number of needed operations. Where in_array only looks for a match in the parametersToExclude array with the given name, the new function iterates trough the whole parametersToExclude, changing all parameters to a regex and that compares them. Performance degradation might occur, as this function will be called on each tracker post/request. A feature suggestion to mysql will be:

  • querystring parameters should already be saved as regex to prevent on the fly generation of regex.

With the code above it is possible to exclude query parameters with a * wildcard, for example:

excluding *test will exclude:


but not:


excluding test will exclude:


It would also be handy if the ‘exclude query parameters’ can be reversed, so that you exclude all except those you define. In some cases it would increase performance, especially for those who exclude a lot of query parameters.