MySQL REGEXP没有空格没有数字

rle*_*mon 4 regex mysql

我试图只返回colA和colB不包含数字或空格的那些行

到目前为止,这是我的代码.

SELECT * FROM table_name WHERE colA REGEXP '[^0-9^\W]' AND colB REGEXP '[^0-9^\W]'
Run Code Online (Sandbox Code Playgroud)

给出数据集

   colA        colB
---------- ----------
     test |  testB
      33  |  text    <- this is not returned
     blah |  0123A   <- this is returned
Run Code Online (Sandbox Code Playgroud)

我假设我的问题是我的正则表达式...请帮忙吗?

Igo*_*vas 5

那么你的表达式不起作用,因为:33是数字,你正在寻找任何非小数,非空白字符.所以它不包括结果中的那一行.

尝试:

SELECT * FROM table_name WHERE colA NOT REGEXP '[0-9[:space:]]' AND colB NOT REGEXP '[0-9[:space:]]'
Run Code Online (Sandbox Code Playgroud)

ETA:是的,忘记了\无论什么都行不通