This patch is inspired by the work that I did for ufdbGuard and a few emails with Amos.
The new code optimises lists of regular expressions.
The optimisations are:
* initial .* is stripped
* RE-1 RE-2 ... RE-n are joined into one large RE: (RE-1)|(RE-2)|...|(RE-n)
* -i ... -i options are optimised: the second one is ignored, same for +i
If compounding optimization fails it falls back to using unoptimized
expressions.