Normal Topic For all the Regex (regular expression) fans (Read 407 times)
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
For all the Regex (regular expression) fans
Apr 10th, 2006 at 11:09pm
Print Post Print Post  
Well all the talk in one of the other threads got me thinking that Sesame 2.0's regular expression capabilities could be nicely expanded. So I added a couple of new search constructs: regex() and qanda(). These are used in a search spec to allow for using Q&A search constructs when in regex mode and using regex syntax when in Q&A syntax mode.

In other words, if you are on a normal search spec (Q&A mode), you can use Q&A search syntax as you ordinarily would, but in any LE you want you could add: "regex(^m.*[0-9]{3}$)" (i.e.: match any string that starts with a "m" and ends with 3 digits), or any other legal regex spec.

It also works in reverse. If you have set the form to be in regex mode, and want to use Q&A syntax in one (or more) of the LEs, just could add "qanda(< 1000)" (or whatever) to those LEs.

You can't mix the two syntaxes in any single LE, but you can mix the syntaxes on any form.

While, regex cannot do the same kind of searches that Sesame/Q&A can do on numerics and dates, etc... I have enabled regex searches on all field types. It treats them all as strings.

I also added another sesame.ini setting, that allows you to control the startup default search syntax for the forms:

DEFAULT SEARCH SYNTAX: [Q&A | REGEX]

That way, if you are unfamiliar with Q&A search syntax, but regular expressions are old hat, you can start Sesame in regex mode. If you don't set it, Q&A syntax is the default.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: For all the Regex (regular expression) fans
Reply #1 - Apr 11th, 2006 at 8:30pm
Print Post Print Post  
Thanks lots Mark, a great option.

You're the man! Grin

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged