Backport RegExp fixes in Lucene 4.10

This should prevent super complex regexes from crashing Elasticsearch by
adding a parameter to limit the amount of work done when compiling the
regex into a dfa.

Change-Id: I88bca8f96a12195a912a64e2950773b0265a124e