![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
I can't say I'm the world's best at regex's but I can usually get them to do as I wish, however today this does not seem to be the case. here's my problem. I'm trying to do a simple search on a database. I would like to be able to recognize 'OR' and 'AND'. I simply want to translate this into an SQL query. Starting out I thought that should be simple but it is proving rather difficult. After failing miserably in my main program I wrote the following test script, really ugly but I'm also trying to see everything:
Consistantly the first element in the array gets switched and the rest of them do not, as though the line isn't even there they simply get appended to $string the way they were entered. The output looks like this:
Printing each element of the array as it loops reveals that the array elements are as expected:
I'm at a complete loss with this one. I'm also interested in simplifying it into something shorter but whatever helps to solve this problem... thanks in advance. In reply to Regex switching problem by cfreak
|
|