/** Return a query with the old (and slow, but more complete) way Lucene implements regular expressions. */
private RegexQuery getFallbackRegexQuery(String str, Element element) {
// No lowercase of str, so '\p{Punct}' doesn't become '\p{punct}':
final RegexQuery query = new RegexQuery(new Term(element.isCaseSensitive() ? FIELD_NAME : FIELD_NAME_LOWERCASE, str));
query.setRegexImplementation(new JavaUtilRegexCapabilities(JavaUtilRegexCapabilities.FLAG_CASE_INSENSITIVE));
return query;
}