Bug #18172 Updated: Mysql_query function RLIKE and REGEXP

From: Date: Mon, 08 Jul 2002 02:30:21 +0000
Subject: Bug #18172 Updated: Mysql_query function RLIKE and REGEXP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13474@lists.php.net to get a copy of this message
ID: 18172 Updated by: sniper@php.net Reported By: r.denis@bell.ca -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: Freebsd/Linux PHP Version: 4.2.1 New Comment: let's keep this at 'feedback' status until we get the real feedback.. Previous Comments: ------------------------------------------------------------------------ [2002-07-05 20:36:37] r.denis@bell.ca Sniper, I appreciate your assistance, The default install of FreeBSD turns on magic_quotes_* It is a nice addition in my opinion. It make things alot easier. Especially when you have peoples names like o\'brien It basically does all of the work for you. I will look into the problem more Tomorrow or Monday. However I do not see how preg_quote will have any bearing. Especially since it Magic quotes takes care of the work. instead of having robert.denis I would have "robert\.denis" This does not explain why it returns some but not all. Have a nice Weekend. Cheers, Robert ------------------------------------------------------------------------ [2002-07-05 15:46:09] sniper@php.net forgot to ask..do you have any of those magic_quotes_* directives set 'on' in php.ini? ------------------------------------------------------------------------ [2002-07-05 15:42:32] sniper@php.net Try doing this: $zcntlogin = preg_quote($zcntlogin); From mysql manual: "Note: Because MySQL uses the C escape syntax in strings (for example, \n'), you must double any \' that you use in your REGEXP strings" a dot '.' is special..so you have to escape it. If this didn't help either, please provide a SHORT but complete example script, max 5 lines, which does not work. ------------------------------------------------------------------------ [2002-07-05 14:57:20] r.denis@bell.ca . ------------------------------------------------------------------------ [2002-07-05 14:34:32] r.denis@bell.ca In order for you to understand. I am going to give you a more logical approch. The mysql server ----------------------------------------- mysql> connect report Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Connection id: 2887 Current database: report mysql> select * from report WHERE users REGEXP 'robert.denis'; +----+---------------------------------------+--------------+------------+---------------------------------------------+ | id | file1 | sysstartdate | sysenddate | users | +----+---------------------------------------+--------------+------------+---------------------------------------------+ | 1 | 20020629.jdbgmgrE.htm | 2002-06-29 | 2002-06-29 | hbpritch robert.denis | | 2 | 20020629.jdbgmgrE.htm | 2002-06-29 | 2002-06-29 | hbpritch robert.denis | | 3 | 20020702.What is CyberArmor Suite.doc | 2002-07-02 | 2002-07-02 | benoit.joubert robert.denis scott.beauchamp | | 4 | 20020702.jdbgmgrE.htm | 2002-07-02 | 2002-07-02 | robert.denis nancy.kolassa | | 5 | 20020702.2002esrq1e.doc | 2002-07-02 | 2002-07-02 | robert.denis melsegui | | 6 | 20020702.putty.exe | 2002-07-02 | 2002-07-02 | robert.denis melsegui | | 7 | 20020702.Rapport_5220111200 Theft.doc | 2002-07-02 | 2002-07-02 | robert.denis melsegui | | 8 | 20020702.Maj-Eng logo elec final.dot | 2002-07-02 | 2002-07-02 | robert.denis melsegui | | 9 | 20020703.meeting4_map.pdf | 2002-07-03 | 2002-07-03 | robert.denis robert.denis | | 10 | 20020704.What is CyberArmor Suite.doc | 2002-07-04 | 2002-07-04 | robert.denis robert.denis | | 11 | 20020704.What is CyberArmor Suite.doc | 2002-07-04 | 2002-07-04 | robert.denis robert.denis | | 12 | 20020704. | 2002-07-04 | 2002-07-04 | robert.denis robert.denis | | 13 | 20020704.jdbgmgrE.htm | 2002-07-04 | 2002-07-04 | robert.denis robert.denis | | 14 | 20020704.jdbgmgrE.htm | 2002-07-04 | 2002-07-04 | robert.denis benoit.joubert | | 15 | 20020704.jdbgmgrE.htm | 2002-07-04 | 2002-07-04 | robert.denis benoit.joubert | | 16 | 20020704.jdbgmgrE.htm | 2002-07-04 | 2002-07-04 | robert.denis rdenis@ruoc4k.on.bell.ca | +----+---------------------------------------+--------------+------------+---------------------------------------------+ 16 rows in set (0.00 sec) --------------------------------- The apache webserver Server: Apache/1.3.26 (Unix) mod_ssl/2.8.10 OpenSSL/0.9.6a mod_perl/1.26 PHP/4.2.1 The php webpage -------------------- Report Summary select * from report WHERE users REGEXP 'robert.denis' 20020629.jdbgmgrE.htm [expand] 20020629.jdbgmgrE.htm [expand] 20020702.What%20is%20CyberArmor%20Suite.doc [expand] 20020702.jdbgmgrE.htm [expand] Total Number of Records: 4 ------------------------------------------ Any ideas? There is nothing with the implimentation of the POSIX regexp. The same sort of thing can be done in almost all scripting languages. -- Regards Robert ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/18172 -- Edit this bug report at http://bugs.php.net/?id=18172&edit=1

« previous php.bugs (#13474) next »