lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agrawal, Aashish \(IT\)" <>
Subject RE: example on RegexQuery
Date Mon, 27 Oct 2008 03:36:39 GMT
Hi Steven

thanks for pointing to the example of RegexQuery. 

I have a simple code snippet which is not working, not sure if I am
using it incorrectly. 
      RegexQuery query = new RegexQuery (new Term (field, line)); 
      query.setRegexImplementation(new JavaUtilRegexCapabilities());
      System.out.println("Searching for: " + query.toString(field));
      Hits hits =; 

I am searching a sample file like below - 
agrawal fdfdf
fsdfafasf 3495549584
fsfsfs fsffsf r4e3fdere j4343  

when I search this file with pattern - 
or even search for   3495549584

all are failing with result no match found..

could you point me what is wrong here ?? Also if I try to search *4343*,
it throws exception,, shouldn't * at start be  allowed with regexQuery ?

Aashish Agrawal

-----Original Message-----
From: Steven A Rowe [] 
Sent: Saturday, October 25, 2008 12:31 AM
Subject: RE: example on RegexQuery 

Hi Aashish,

On 10/24/2008 at 3:35 AM, Agrawal, Aashish (IT) wrote:
> I want to use lucene for a simple search engine  with regex support .
> I tried using RegexQuery.. but seems I am missing something.
> Is there any working exmaple on using RegexQuery ??

How about TestRegexQuery?:



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

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in error.

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

View raw message