For reference, the version I'm using is:
mysql Ver 10.11 Distrib 3.23.23-beta, for pc-linux-gnu (i686)
(which I am not in a position to upgrade ,tho I could always ask)
I'm having some difficulties getting the REGEXP/RLIKE to work.
I'm trying to match on what is basically "$name[0-9]*" (the
name is input to the web page which then constructs the
select statement).
The statement I have is:
$db_input = "SELECT COUNT(*) FROM hold_tbl WHERE dog_name RLIKE
"^$FORM{'proposed_name'}\[0123456789]*\" ORDER BY dog_name";
(because this is perl, I need the \[ to prevent it from thinking
I'm trying to treat $FORM as an array)
However, this is behaving as if I'd entered
$db_input = "SELECT COUNT(*) FROM hold_tbl WHERE dog_name LIKE
"$FORM{'proposed_name'}%" ORDER BY dog_name";
instead. That is, supposing $FORM{'proposed_name'} is "Sam", it is
matching to "Samuel", "Samantha", etc and not just Sam, Sam2, Sam3
as I want.
The debugging info I'm getting is:
input is >SELECT dog_name FROM hold_tbl WHERE dog_name RLIKE "^sam[0123456789]*" ORDER
BY dog_name<
(and then printing out each of the matches made)
Sam
Sam4
Sam5
Sammie6
Sammy7
Sampson2
Samson
Samuel
As I understand it, only the first three should have matched.
Actually, as I really understand it none of them should have matched
because REGEXP/RLIKE are case sensitive searches. It makes no difference
if I use REGEXP instead of RLIKE.
Also, I couldn't find any indication that mysql's regexp understood
[0-9] as opposed to [0123456789], am I correct? Again, it makes no
difference if I try that notation.
Thanks,
--Cindy
--
[EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php