On Wed, Jun 7, 2017 at 2:18 PM, Milos Rancic millosh@gmail.com wrote:
- I would write the regex this way: "^X-Spam-Score:\s*[0-9]+.[0-9]+(+*)"
Note that "^" is here because SMTP protocol requires the filed to start at the beginning of the line. We can't be sure what's at the end of the line.
This regex matches zero to inifinty '+' characters in the X-Spam-Score header. The original regex of "X-Spam-Score:[^+]*[+]{4,}" only matches when four or more '+' characters occur in series in the header. I know that regex works with mailman because I use it on the labs-l and labs-announce lists. Updating it with a start of line anchor would be fine too: "^X-Spam-Score:[^+]*[+]{4,}"
For anyone who doesn't read regex fluently (and honestly why should you), this pattern says: * "^" : match only at the start of a new line * "X-Spam-Score:" : match this literal string * "[^+]*" : match zero to infinity characters that are not '+' * "[+]{4,}" : match four to infinity '+' characters in series
Bryan