Bug #12798 regexp {} does not consider specified upper limit of atom occurrence
Submitted: 25 Aug 2005 8:32 Modified: 25 Aug 2005 9:02
Reporter: Isabel Barth Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.6 and 5.0.11 OS:Microsoft Windows (Win XP)
Assigned to: CPU Architecture:Any

[25 Aug 2005 8:32] Isabel Barth
A given maximum number of occurrence of a substring within a regular expression is ignored by the server. Only the lower bound is considered

How to repeat:

mysql> select "aaaaaaaa" regexp 'a{2}';
| "aaaaaaaa" regexp 'a{2}' |
|                        1 |

mysql> select "aaaaaaaa" regexp "[a]{1,1}";
| "aaaaaaaa" regexp "[a]{1,1}" |
|                            1 |
1 row in set (0.00 sec)
[25 Aug 2005 9:02] Valeriy Kravchuk
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

According to tyhe manual (http://dev.mysql.com/doc/mysql/en/regexp.html):

" To be more precise, a{n} matches exactly n instances of a. a{n,} matches n or more instances of a. a{m,n}  matches m through n  instances of a, inclusive."

So, when you are asking:

select "aaaaaaaa" regexp "[a]{1,1}";

you are really asking if the string matches 1 instance of a. And yes, it matches, so you are getting 1 as a result.