OS2web/os2web_cpr_filter — pull request #2 by petsoe (2014-08-13 11:26:54+00:00)
Title: Improved regex. Fixed flawed replacement logic.

We had some problems with false positives. A link to a video (http://media.videotool.dk/?vn=260_2014021815250419561819634619) was replaced by (http://media.videotool.dk/?vn=260_2014021815XXXXXX-XXXX19634619).
The improved regex in this hotfix removes some false positives while also including more possible matches.

The replacement logic was flawed:
If mod11 setting is false in line 69 the expression will always evaluate to true and thus enter line 70. This will then make the text replacement and code will not continue to make the date check even if the module is configured to check for dates.

If mod 11 setting is true and the match is positively validated agains modulus11 in line 69, the expression will evaluate to true and enter line 70 and make the text replacement even if the module is configured to also check for date validation. Example match: 851248-1230. This number validates against modulus11, but not against the date check. If i have configured my module to check for both date and mod11 this number should not be replaced.

This hotfix changes the replacement logic:
If replace_all_dash setting is on, any match containing a dash will be replaced not taking any of the other settings into account.
Also the modulus11 check and date check now works in unison so that numbers like 851248-1230 are not replaced if both checks are on.