in reply to Re: Parsing a boolean search string for SQL query
in thread Parsing a boolean search string for SQL query

This is not the first time where i have seen the split solution be more robust than the substitute solution. I just ran your code with the following string:
my $searchstring = "aaaa OR bbbb OR NOT cccc AND dddd";
And was happy to see the following results (formatted for the Monastery):
regex:
   (fieldname = 'aaaa') OR 
   (fieldname = 'bbbb') OR 
   (fieldname = 'NOT')
   (fieldname = 'cccc') AND
   (fieldname = 'dddd')

split/join:
   (fieldname = 'aaaa') OR 
   (fieldname = 'bbbb') OR NOT 
   (fieldname = 'cccc') AND 
   (fieldname = 'dddd')

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
  • Comment on 2Re: Parsing a boolean search string for SQL query