Mysql/phpmyadmin中的正则表达式 [英] Regular expressions in Mysql/phpmyadmin
问题描述
我对想要使用MySQL/phpMyAdmin的正则表达式有疑问.是下一个:
I have a question on a regular expression wanting to use MySQL / phpMyAdmin. Is the next:
^ [^ 0-9] $
因为它不返回包含数字的表中的任何元组,但是问题是返回包含数字的元组.完整的声明是:
As it is to not return any tuple in the table containing numbers, but the problem is that returns a tuple with contains numbers. The full statement is:
SELECT * FROM person WHERE name REGEXP "^ [^ 0-9] $";
所以我不知道这是什么问题.因为我有两个具有真实名称的元组和一个假"元组,所以它是纯数字,并返回带有数字的该元组句子.
So I do not know what is the problem. Because I have two tuples that have real names and a "false" tuple it is pure numbers and returns that tuple sentence with numbers.
注意:人"表中的名称"列为varchar.
Note: the "name" column in the "person" table is varchar.
推荐答案
您似乎正在尝试返回没有数字的列,对吗?
It looks like you are trying to return columns that don't have numbers, is that correct?
如果这样的话我认为
SELECT * FROM person WHERE name not REGEXP '[0-9]'
将是最简单的方法.
您的正则表达式当前正在查找具有前导空格,非数字或空格,然后要结束的空格的列.
Your regex currently looks for a column that has a leading whitespace, a non-number or whitespace, and then a white space to end.
演示: http://sqlfiddle.com/#!9/6b047/2
这篇关于Mysql/phpmyadmin中的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!