FWIW, here's an updated version. The previous version ran into some issues with handling complex queries (like (foo:("bar"))) and stuff. Added validation to ensure quote marks are closed.
Kelvin ----- Original Message ----- From: "Kelvin Tan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 10, 2002 5:41 PM Subject: Javascript query validation > Note: this file has only been tested in IE 6.0. > > Frustrated with curious TokenMgrErrors and ParseExceptions in your web > forms? (I was) Not so good at regular expressions? (I'm not) > > See attached for a (simple) implementation of a regex-based javascript query > validator. Currently, only wildcards (*), plus and minus (+, -), parentheses > (round brackets) and field declarers (:) are validated for. The reason's coz > they're the most commonly used (IMHO) and I'm lazy. > > If you do add to it/fix any bugs, I'd appreciate if you could drop me a buzz > so I can update it, or post it to the list for everyone to use. > > Note: I've found that in IE at least, hitting the enter button with a text > field in focus irritatingly submits the form without giving me a chance to > validate the query. I've had to disable the "Enter" key for the form fields. > Email me offline if you need help with this. > > Regards, > Kelvin Tan > > Relevanz Pte Ltd > http://www.relevanz.com > > 180B Bencoolen St. > The Bencoolen, #04-01 > S(189648) > > Tel: 6238 6229 > Fax: 6337 4417 > > ---------------------------------------------------------------------------- ---- > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
luceneQueryValidator.zip
Description: Zip archive
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>