pingcap / pingcap/tidb

invalid escape sequence: `\\u`' from regexp

Open
#37,886 0 comments 0 reactions 1 assignee Claimed by @xzhangxian1008 View on GitHub
affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 affects-8.1 may-affects-4.0 may-affects-5.0 may-affects-5.1 may-affects-5.2 may-affects-5.3 may-affects-5.4 may-affects-6.0 may-affects-6.1 may-affects-6.2 severity/major sig/execution type/bug
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)
```sql
set sql_mode = "";
select regexp_like('莼潔婕', '^[\\u4e00-\\u9fa5]{0,}$');
set sql_mode = "NO_BACKSLASH_ESCAPES";
select regexp_like('莼潔婕', '^[\u4e00-\u9fa5]{0,}$');

```

### 2. What did you expect to see? (Required)
```sql
MySQL root@172.16.4.90:hchwang> set sql_mode = "NO_BACKSLASH_ESCAPES";
Query OK, 0 rows affected
Time: 0.043s
MySQL root@172.16.4.90:hchwang> select regexp_like('莼潔婕', '^[\u4e00-\u9fa5]{0,}$');
+------------------------------------------------+
| regexp_like('莼潔婕', '^[\u4e00-\u9fa5]{0,}$') |
+------------------------------------------------+
| 1 |
+------------------------------------------------+

1 row in set
Time: 0.050s
MySQL root@172.16.4.90:hchwang> set sql_mode = "";
Query OK, 0 rows affected
Time: 0.052s
MySQL root@172.16.4.90:hchwang> select regexp_like('莼潔婕', '^[\\u4e00-\\u9fa5]{0,}$');
+--------------------------------------------------+
| regexp_like('莼潔婕', '^[\\u4e00-\\u9fa5]{0,}$') |
+--------------------------------------------------+
| 1 |
+--------------------------------------------------+
```
### 3. What did you see instead (Required)
```sql
MySQL root@127.0.0.1:reg> set sql_mode = "";
Query OK, 0 rows affected
Time: 0.001s
MySQL root@127.0.0.1:reg> select regexp_like('莼潔婕', '^[\\u4e00-\\u9fa5]{0,}$');
(1139, "Got error 'error parsing regexp: invalid escape sequence: `\\u`' from regexp")
MySQL root@127.0.0.1:reg> set sql_mode = "NO_BACKSLASH_ESCAPES";
Query OK, 0 rows affected
Time: 0.001s
MySQL root@127.0.0.1:reg> select regexp_like('莼潔婕', '^[\u4e00-\u9fa5]{0,}$');
(1139, "Got error 'error parsing regexp: invalid escape sequence: `\\u`' from regexp")
MySQL root@127.0.0.1:reg>
```
### 4. What is your TiDB version? (Required)
Git Commit Hash: 95f4b119c03f11580e0cdd9c0875f52e13c14611

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.