REGEXP '$' does not match before a trailing newline
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
SELECT 'a\n' REGEXP 'a$';
-- TiDB: 0 | MySQL 9.7.2: 1 | MariaDB: 1
```
### 2. What did you expect to see? (Required)
```
mysql> SELECT 'a\n' REGEXP 'a$';
+-------------------+
| 'a\n' REGEXP 'a$' |
+-------------------+
| 1 |
+-------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```
mysql> SELECT 'a\n' REGEXP 'a$';
+-------------------+
| 'a\n' REGEXP 'a$' |
+-------------------+
| 0 |
+-------------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```
mysql> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-2174-g65ac2fad58-dirty
Edition: Community
Git Commit Hash: 65ac2fad582510b92d3c4b79999e48217c989737
Git Branch: master
UTC Build Time: 2026-08-30 15:18:00
GoVersion: go1.25.12
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Contributor guide
Research direction
Start by running the reported `SELECT 'a\n' REGEXP 'a$';` query and compare TiDB's result with the MySQL and MariaDB results shown in the issue. Trace the REGEXP evaluation path and its existing tests; done means a trailing newline is accepted by `$` and the query returns 1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mariadb, mysql, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100