UPDATE shop SET desn2 = "" WHERE desn2 REGEXP "[(联通)(移动)(电信)]";
我用这句的时候,发现中文都被清空了,而一些只有数字或者英语组成的单元格却没有被清空,请问怎么办?
我试了试,只要使用了中括号,就会莫名其妙被匹配:我觉得应该是他把中文,分解成了 编码 ,然后用编码去匹配的你自己写个试试.
SELECT '大家好' REGEXP '[不存在]';
这个应该不存在,但是她就是存在了!
闭关修行中......
This is just my understanding. There is no guarantee as to whether it is correct or not. This is the "[]" description of mysql regular:
[ ] matches any single character.
[123] defines a set of characters, meaning to match 1 or 2 or 3.
Then, the way I understand characters to be saved is ascii code, which makes it easier to understand why there is a concept of character sets.
SELECT ASCII('Hello everyone'),ASCII('does not exist')==>The data result is: 229 228
Then it’s easy to understand why: select 229 REGEXP '[228]'==>1
select * from shop WHERE desn2 REGEXP "[(China Unicom)(Mobile)(Telecom)]";
Execute it and see what data matches the outputIt is best to send the results so that you can analyze them
This is just my understanding. There is no guarantee as to whether it is correct or not.
This is the "[]" description of mysql regular:
[ ] matches any single character.
[123] defines a set of characters, meaning to match 1 or 2 or 3.
Then, the way I understand characters to be saved is ascii code, which makes it easier to understand why there is a concept of character sets.
SELECT ASCII('Hello everyone'),ASCII('does not exist')
==>
The data result is: 229 228
Then it’s easy to understand why: select 229 REGEXP '[228]'==>1
select * from shop WHERE desn2 REGEXP "[(China Unicom)(Mobile)(Telecom)]";
Execute it and see what data matches the output
It is best to send the results so that you can analyze them