API doc says that:

Lucene supports regular expression searches matching a pattern between
forward slashes "/". The syntax may change across releases, but the current
supported syntax is documented in the RegExp class. For example to find
documents containing "moat" or "boat":
/[mb]oat/

I think that this may help you:

http://lucene.apache.org/core/4_3_0/core/org/apache/lucene/util/automaton/RegExp.html


2013/5/22 Oussama Jilal <jilal.ouss...@gmail.com>

> There is no ^ or $ in the solr regex since the regular expression will
> match tokens (not the complete indexed text). So the results you get will
> basicly depend on your way of indexing, if you use the regex on a tokenized
> field and that is not what you want, try to use a copy field wich is not
> tokenized and then use the regex on that one.
>
>
> On 05/22/2013 11:53 AM, Stéphane Habett Roux wrote:
>
>> I just can't get the $ endpoint to work.
>>
>>  I am not sure but I heard it works with the Java Regex engine (a little
>>> obvious if it is true ...), so any Java regex tutorial would help you.
>>>
>>> On 05/22/2013 11:42 AM, Sagar Chaturvedi wrote:
>>>
>>>> Yes, it works for me too. But many times result is not as expected. Is
>>>> there some guide on use of regex in solr?
>>>>
>>>> -----Original Message-----
>>>> From: Oussama Jilal [mailto:jilal.ouss...@gmail.com]
>>>> Sent: Wednesday, May 22, 2013 4:00 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: Regular expression in solr
>>>>
>>>> I don't think so, it always worked for me without anything special,
>>>> just try it and see :)
>>>>
>>>> On 05/22/2013 11:26 AM, Sagar Chaturvedi wrote:
>>>>
>>>>> @Oussama Thank you for your reply. Is it as simple as that? I mean no
>>>>> additional settings required?
>>>>>
>>>>> -----Original Message-----
>>>>> From: Oussama Jilal [mailto:jilal.ouss...@gmail.com]
>>>>> Sent: Wednesday, May 22, 2013 3:37 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: Regular expression in solr
>>>>>
>>>>> You can write a regular expression query like this (you need to
>>>>> specify the regex between slashes / ) :
>>>>>
>>>>> fieldName:/[rR]egular.*/
>>>>>
>>>>> On 05/22/2013 10:51 AM, Sagar Chaturvedi wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> How do we search based upon regular expressions in solr?
>>>>>>
>>>>>> Regards,
>>>>>> Sagar
>>>>>>
>>>>>>
>>>>>>
>>>>>> DISCLAIMER:
>>>>>> ---------------------------------------------------------------------
>>>>>> -
>>>>>> -------------------------------------------------
>>>>>> The contents of this e-mail and any attachment(s) are confidential
>>>>>> and intended for the named recipient(s) only.
>>>>>> It shall not attach any liability on the originator or NEC or its
>>>>>> affiliates. Any views or opinions presented in this email are solely
>>>>>> those of the author and may not necessarily reflect the opinions of
>>>>>> NEC or its affiliates.
>>>>>> Any form of reproduction, dissemination, copying, disclosure,
>>>>>> modification, distribution and / or publication of this message
>>>>>> without the prior written consent of the author of this e-mail is
>>>>>> strictly prohibited. If you have received this email in error please
>>>>>> delete it and notify the sender immediately. .
>>>>>> ---------------------------------------------------------------------
>>>>>> -
>>>>>> -------------------------------------------------
>>>>>>
>>>>>
>>>>> DISCLAIMER:
>>>>> ----------------------------------------------------------------------
>>>>> -------------------------------------------------
>>>>> The contents of this e-mail and any attachment(s) are confidential and
>>>>> intended for the named recipient(s) only.
>>>>> It shall not attach any liability on the originator or NEC or its
>>>>> affiliates. Any views or opinions presented in this email are solely
>>>>> those of the author and may not necessarily reflect the opinions of
>>>>> NEC or its affiliates.
>>>>> Any form of reproduction, dissemination, copying, disclosure,
>>>>> modification, distribution and / or publication of this message
>>>>> without the prior written consent of the author of this e-mail is
>>>>> strictly prohibited. If you have received this email in error please
>>>>> delete it and notify the sender immediately. .
>>>>> ----------------------------------------------------------------------
>>>>> -------------------------------------------------
>>>>>
>>>>
>>>>
>>>> DISCLAIMER:
>>>>
>>>> -----------------------------------------------------------------------------------------------------------------------
>>>> The contents of this e-mail and any attachment(s) are confidential and
>>>> intended
>>>> for the named recipient(s) only.
>>>> It shall not attach any liability on the originator or NEC or its
>>>> affiliates. Any views or opinions presented in
>>>> this email are solely those of the author and may not necessarily
>>>> reflect the
>>>> opinions of NEC or its affiliates.
>>>> Any form of reproduction, dissemination, copying, disclosure,
>>>> modification,
>>>> distribution and / or publication of
>>>> this message without the prior written consent of the author of this
>>>> e-mail is
>>>> strictly prohibited. If you have
>>>> received this email in error please delete it and notify the sender
>>>> immediately. .
>>>>
>>>> -----------------------------------------------------------------------------------------------------------------------
>>>>
>>>
>

Reply via email to