Bug #1133 regexp bug
Submitted: 25 Aug 2003 5:35 Modified: 29 Aug 2003 6:48
Reporter: Sergey Beduev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:3.23.56 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[25 Aug 2003 5:35] Sergey Beduev
Description:
I have some troble with regexp on MySQL 3.23.56 
mysql> CREATE TEMPORARY TABLE Test1 (ID INT,Description TEXT);
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO Test1 VALUES ('1','test: 16:25:14 (4098907/35561512)');
Query OK, 1 row affected (0.02 sec)

mysql> SELECT count(*) FROM Test1 WHERE Description REGEXP '^[^:]+: [0-9]+:[0-9]+:[0-9]+ \([0-9]+\/[0-9]+\)$';
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql> SELECT count(*) FROM Test1 WHERE Description REGEXP '^[^:]+: [0-9]+:[0-9]+:[0-9]+ \([0-9]+/[0-9]+\)$';
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.01 sec)

How to repeat:
CREATE TEMPORARY TABLE Test1 (ID INT,Description TEXT);

INSERT INTO Test1 VALUES ('1','test: 16:25:14 (4098907/35561512)');

SELECT count(*) FROM Test1 WHERE Description REGEXP '^[^:]+: [0-9]+:[0-9]+:[0-9]+ \([0-9]+\/[0-9]+\)$';
SELECT count(*) FROM Test1 WHERE Description REGEXP '^[^:]+: [0-9]+:[0-9]+:[0-9]+ \([0-9]+/[0-9]+\)$';
DROP TABLE Test1;
[29 Aug 2003 6:48] Alexander Keremidarski
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Same as #412 http://bugs.mysql.com/412 and other bugs.

Backslash is escaping character and must be escaped itself.

mysql> SELECT count(*) FROM Test1 WHERE Description REGEXP '^[^:]+: [0-9]+:[0-9]+:[0-9]+ \\([0-9]+/[0-9]+\\)$';
+----------+
| count(*) |
+----------+
|        1 |
+----------+