![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Regex switching problemby cfreak (Chaplain) |
on Oct 20, 2001 at 01:38 UTC ( #120159=perlquestion: print w/replies, xml ) | Need Help?? |
cfreak has asked for the wisdom of the Perl Monks concerning the following question: 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.
Back to
Seekers of Perl Wisdom
|
|