jrr
05-28-2003, 05:24 PM
I have a PHP script that uses MySQL (v3.23.53-max-nt) REGEXPs,
and these seemed to be working fine until it needed to use the
condition:
msg_text REGEXP 'status: \(failed\)'
I knew there was a record containing this string. But the script
didn't return it, until I had reduced the condition to:
msg_text REGEXP '\(failed\)'
The problem seems to be caused by the colon, despite this not
being a reserved character (as far as I can tell from the MySQL
manual).
Also, the manual says that preceding special characters by '\'
causes them to be treated as normal characters. So why in
that case does MySQL complain about 'unbalanced brackets'
when I tried running:
msg_text REGEXP '\(fail'
Luckily, I was able to work round these problems by using
a LIKE clause instead. But if anyone has an explanation for
either or both these problems, I'd be very interested.
Cheers
John R Ramsden (john_ramsden@sagitta-ps.com)
and these seemed to be working fine until it needed to use the
condition:
msg_text REGEXP 'status: \(failed\)'
I knew there was a record containing this string. But the script
didn't return it, until I had reduced the condition to:
msg_text REGEXP '\(failed\)'
The problem seems to be caused by the colon, despite this not
being a reserved character (as far as I can tell from the MySQL
manual).
Also, the manual says that preceding special characters by '\'
causes them to be treated as normal characters. So why in
that case does MySQL complain about 'unbalanced brackets'
when I tried running:
msg_text REGEXP '\(fail'
Luckily, I was able to work round these problems by using
a LIKE clause instead. But if anyone has an explanation for
either or both these problems, I'd be very interested.
Cheers
John R Ramsden (john_ramsden@sagitta-ps.com)