lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Lucene and Regex - ?
Date Thu, 05 Jan 2006 11:48:14 GMT

RegexQuery is similar in behavior to Lucene's built-in WildcardQuery,  
except rather than accepting only ? and * as wildcard characters it  
leverages the full expression capability of whatever underlying  
regular expression engine is selected.

SpanRegexQuery is a "span" version of RegexQuery, allowing for  
queries like "j.v. l.*" that could match "java lucene" and any other  
two sequential terms that match those patterns.  There currently is  
no QueryParser support for this kind of syntax.  Perhaps in the  
future the neutral part of (Span)RegexQuery could be moved into the  
core (it currently lives in contrib/regex and has dependencies on  
Jakarta Regexp, and likely Jakarta ORO also) to facilitate future  
QueryParser support.  For now you'll need to construct the queries  
via the API, build a custom QueryParser extension, or a completely  
custom QueryParser.

The test cases are generally the best place to look for usage examples.

I am working on polishing the documentation and tidying some loose  
ends with contrib/regex, but patches/suggestions always welcome.


On Jan 4, 2006, at 4:41 PM, Dmitry Goldenberg wrote:

> Hi,
> Can someone provide a quick summary of the Regex capabilities in  
> Lucene? I see there's a RegexQuery and a SpanRegexQuery - what are  
> they intended for and how do I use them?
> Thanks,
> - Dmitry

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message