# MySQL正则不支持-d和大小写的问题

{% embed url="<https://v.douyin.com/r2hf4Wh/>" %}

{% embed url="<https://www.bilibili.com/video/BV1QU4y1U7AA/>" %}

这两天碰到一个问题

上网一搜

发现他是一个MySQL官方认证的Bug

Bug号是

70413

大概意思就是

MySQL的正则里面不支持\d

大家看啊

这是个0

它 \d 返回的是0

就是假的

那我们要给他改成0杠9呢

他就是真了

那官方的答复是除了这样写呢

他还可以使用 POSIX 的表达式

这样写

把它复制一下

这样写我们来试一下

他也是可以的

比如说我们是多个

看看他也是可以的

那根据这个呢

我后来又发现一个好玩的东西

就是

因为我就好奇

他这个表达是还有其他的语法没有

我就看了一下他给的这个链接

进去以后呢找到了这个

但因为这个不是很直观哈

我又从网上找到这样一个图

然后呢

这里边就多了两个MySQL不支持的

一个是

word

不支持还有一个是 ascii

其他的都支持

后来我试到这个 upper 和 lower 的时候

发现有问题

大家看啊

这些个 upper 按说他只支持（匹配）大写

但是呢 我写个小写，大家看

他也认为是真的

包括我这里边写 lower

然后呢这写个大写

他也不认识（匹配为真）

开始哈我以为这又是一个 bug

后来发现其实不是

其实就是MySQL

对大小写不敏感的问题

所以呢

解决这个问题可以在这加一个 binary

做一个转换

大家看 这样就区分了（正则发现不匹配了）

小写就可以了（匹配了）

或者把 binary 放前面

这样也可以

比如说这写一个upper

ok 这样就可以了


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sunzsh.gitbook.io/xiaoshan.bug/mysql-zheng-ze-bu-zhi-chidhe-da-xiao-xie-de-wen-ti.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
