Bug with Data Exports and FilterByRegex

In documentation for Data_Exporter it's mentioned "filterByRegExp" and how "Any value that does NOT match this PCRE regular expression is filtered and not exported"

This is false, as the codeline states: (models/ca_data_exporters.php, line 2114)

if ($vs_regexp && preg_match("!{$vs_regexp}!", $va_item['text'])) { continue; }

If the regex match, continue. Or in other words, skip that export value.

To only export values matching the regex, one should invert the result of the preg_match, as to only continue on stuff that doesn't match.


Tested this by making an object with the description "test", running the filterByRegex: {"filterByRegExp": "test"} in my export sheet.

Expected behaviour would be that only objects with that exact description would get their descriptions exported, but the inverse was true. Only objects not matching got exported. After inverting the result from preg_match I got the expected behaviour.

Sign In or Register to comment.