@danielfett opened this Issue on February 9th 2016

There may be more than one "(" or ")" in regular expression used for dimension extraction although there is only one capturing group. Examples include non-capturing groups, modificators like "(?i)", and escaped character sequences like "(". Regular expressions with more than one "(" or ")" are rejected currently.

This is captures exactly one group, yet is not allowed. (This is what I wanted to use in my project, actually.)

Root cause:
Counting the number of "(" or ")" as is done in https://github.com/piwik/plugin-CustomDimensions/blob/master/Dimension/Extraction.php#L46 is just wrong: It does not ensure that there is exactly one capturing group.

Better solutions:
Short term: Remove this useless test. Add an example or warning regarding the number of groups.
Long term: Include "live-preview" of matches as described in another bug report. Warn when more than one group captures.

Powered by GitHub Issue Mirror