Add env filter regex option for test reports

There is now a regex filter option to clean out the environment before
writting the test report.
First of all, store the value returned by `build_option('environment-filter-regex')` outside the for loop

Second: how can this ever work? `build_option('environment-filter-regex')` will return a string, which doesn't have `.search`? You're not compiling the regex anywhere (which you can/should also do outside of the for loop).

The unit tests should also be extended to verify this functionality (since this must be broken pretty hard right now).