Bug #70413 \d is not working in REGEXP for a MySQL query
| Submitted: | 25 Sep 2013 7:07 | Modified: | 3 Oct 2013 13:29 |
|---|---|---|---|
| Reporter: | Konrád Lőrinczi | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.5.31, 5.5.34, 5.6.14 | OS: | Linux (Debian Wheezy v7.1) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Debian, number match, REGEXP, Wheezy | ||
[25 Sep 2013 7:07]
Konrád Lőrinczi
[25 Sep 2013 7:12]
Konrád Lőrinczi
Added version info.
[25 Sep 2013 7:30]
Konrád Lőrinczi
Updating example query.
This query has a valid regular expression, but still does not result anything:
SELECT '2013-2014-1' REGEXP '\d{4}-\d{4}-\d{1}';
The following query will work correctly:
SELECT '2013-2014-1' REGEXP '[0-9]{4}-[0-9]{4}-[0-9]{1}';
[3 Oct 2013 13:29]
MySQL Verification Team
Hello Konrád,
Thank you for the report.
Verified as described.
MySQL support POSIX expression [[:digit:]].
mysql> SELECT '1234-1234-12' REGEXP '[[:digit:]]{4}\-[[:digit:]]{4}\-[[:digit:]]{2}';
+------------------------------------------------------------------------+
| '1234-1234-12' REGEXP '[[:digit:]]{4}\-[[:digit:]]{4}\-[[:digit:]]{2}' |
+------------------------------------------------------------------------+
| 1 |
+------------------------------------------------------------------------+
http://dev.mysql.com/doc/refman/5.1/en/regexp.html#operator_regexp
Thanks,
Umesh
[12 Mar 2020 6:27]
Mark Winters
It's now 2020 with MySQL version 10.2, and this is STILL broken. Outrageous! So having to remap all use of \d to [0-9] is "non critical"? Will it have the same performance?
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.