Use of Regex For Pattern Matching

42 views
Skip to first unread message

Shubha Lakshmi

unread,
Sep 21, 2017, 3:21:48 AM9/21/17
to RavenDB - 2nd generation document database
Hi,
  I am doing a PoC for RavenDB, where I am evaluating whether all the use cases in the Application under Question are being met by RavenDB. We Use Regex (C# Regex API) heavily for some pattern matching, but I observed that RavenDB does not provide any direct support for using regexes.
E.g: I cannot issue a query like : 
 var results3= session.Query<Employee>().Where(t=>regex.IsMatch(t.FirstName));

 Regex is  a  C# Supported Regular Expression , something like  
Regex regex = new Regex(@"[A-P]")
Though we use more complex patterns.
But On executing this query,  get a NotSupportedException.

Could you please help me with appropriate links to documentation where I can explore options to implement regex based pattern matching in ravenDB.
Thanks.

Oren Eini (Ayende Rahien)

unread,
Sep 21, 2017, 4:54:12 AM9/21/17
to ravendb
RavenDB does not support regex in queries.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shubha Lakshmi

unread,
Sep 22, 2017, 1:32:06 AM9/22/17
to RavenDB - 2nd generation document database
thanks Oren , Is there any guide to wildcards which are allowed in pattern based search in RavenDB , i.e. in the method :

Session.Query<T>().Search(fieldSelector, searchTerms ....)

In general in searchTerms , what all wildcards would be allowed , because while working with MulitMap index example in bootcamp, I observed that other than '*' other wildcards like ?,^,$,_ etc. were ineffective.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Sep 22, 2017, 3:49:38 AM9/22/17
to ravendb
* and ? are supported, that is all
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Shubha Lakshmi

unread,
Sep 22, 2017, 6:00:15 AM9/22/17
to RavenDB - 2nd generation document database
Thanks Oren , But a searchTerm like "R?b*" is failing to match "Robert" (Employee.FirstName) in Employee collection in NorthWind database..Please correct me if my understanding of usage of '?' wildcard is wrong, I am assuming that it is used to represent 1 or more characters.

Oren Eini (Ayende Rahien)

unread,
Sep 22, 2017, 6:57:26 AM9/22/17
to ravendb
IIRC, there is only a single wild card being processed. Lucene doesn't really like them too much
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages