| 
 Posted by brendan on 09/07/05 14:34 
my regular expression knowledge is admittedly amateurish ... I have spent an 
hour trying to get this to work without any great success, but am in the 
middle of a big project so I can't waste a day fiddling around to get it to 
work (although I might have to if someone here can't help). 
 
I thought I would throw it out to the group to see if anyone could solve the 
problem quick and easy. 
 
I need to break a search string into components to search against a 
database. 
We want to allow the user to specify database columns by using 
 
[column name][colon][search text] 
 
i.e. 
"author:Jane Smith institution:university of Cambridge year:1976" 
 
so basically we have to split the string at the beginning of any word that 
ends in a colon. 
I need then get an array with column_name=>column_value to construct a SQL 
query from. 
 
At the moment I'm just getting garbage or parse errors ... Can anyone help? 
Accolades for anyone that can. A pint of lager for anyone in Cambridge that 
can! 
cheers 
Brendan.
 
  
Navigation:
[Reply to this message] 
 |