To answer your original question, the full Java regex syntax is supported.

A space in a regex query would need to be escaped with backslash, otherwise it ends a term.

What is a sample field value and the actual query you tried?

What are you using as a client? The client language could require a THIRD level of escaping (four backslashes for each backslash to be used in a regex), such as if you were using SolrJ.

-- Jack Krupansky

-----Original Message----- From: Hugh Cayless
Sent: Thursday, August 29, 2013 12:49 PM
To: solr-user@lucene.apache.org
Subject: Re: regex constructs allowed in queries

Tried that, I'm afraid. No joy. I'm trying to step a search through with a debugger attached to see if I can tell why it's not acting right…

On Aug 29, 2013, at 12:23 , Jack Krupansky <j...@basetechnology.com> wrote:

You probably just need to escape the backslashes with a backslash - otherwise the query parser will treat your backslashes as escapes and remove them. This is not unlike placing a regex in a Java string literal.

-- Jack Krupansky

-----Original Message----- From: Hugh Cayless
Sent: Thursday, August 29, 2013 12:08 PM
To: solr-user@lucene.apache.org
Subject: regex constructs allowed in queries

Hi, I can't find anywhere good documentation of what syntax is allowed in Solr 4.4 regular expression searches. I can get regexes to work, but the same search with a predefined character class (like \s) or a word boundary matcher (\b) returns nothing. I am searching an untokenized field and using a plain space (' ') instead of '\s' works fine.

Is there a different escape syntax for regex constructs using a backslash? Is the regex support just incomplete? Or am I hitting some sort of bug?

Thanks,
Hugh=

Reply via email to