微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-选择包含非ASCII字符的行

问题是:我已经从mochimedia中导入了大约20000个游戏描述到我的数据库中,但是有很多外国游戏,我不想列出.

我提出此查询来查找具有非ASCII字符的列

SELECT * FROM TABLE WHERE NOT HEX(COLUMN) REGEXP '^([0-7][0-9A-F])*$';

请注意,我在stackoverflow上找到了此解决方案,因为如果涉及mySQL查询,我不是专家.

但是,尽管此查询捕获了一些外来的描述,但有时它似乎也失败了,并且找到了非常好的描述,因此我要寻找的是对该查询进行微调以跳过“尚可”的描述.

这是一些返回的行,它们“还可以”,这意味着不应返回它们:

Game Boy Jam game that uses game boy restrictions. It’s a western
platform game, where you play as a sheriff of the town. Your mission
is to capture all the bad bandits in the land and bring them to
justice.

还有一个

It’s hard to be a kitten if you have such a clumsy owner! Yesterday
she lost a lot of things in the park and Now it’s up to you to find
them!

Memories of that day can be helpful – you should remember where have
you seen that thing last and search there.Map also can be usefull for
your task. And finally you can climb up a tree and ask a big cat for a
hint – you will see all the events of that day again.

But sometimes it’s not enough to just find a lost thing. Some
residents of the park may already be using it for themselves – be it
mice or ants. In that case you may have to bring them something in
exchange for a lost thing – only then you will get it back.

最后一个例子

Hungry honey bee is a unique fun game. It includes the fun of a
platform game, puzzle game, adventure game, role playing game. In this
fantasy game, one needs to make honey bee to collect all the flowers
in order to win a match. As level progresses new challenges will be
introduced with gradually toughness. Overall it’s a complete blend of
fun which makes one stick with the game for hours. GOI: rating 4.5 our
of 5

请记住,我不是MysqL专家,所以我只能猜测问题出在哪里,我的猜测是某些字符(例如

或字符中的“和”:

可能会导致此.

也许有人愿意共享优化查询解决此问题?我花了一些时间来解决这个问题,但是考虑到我仍然是PHP的新手,而且绝对不是REGEXP和mySQL查询的专家,在这里获得一些帮助会很高兴,这样我可以提高自己的知识.请不要以为只要您将它扔给我,我就能理解您所说的话,因此详细的帮助将非常有用.

感谢您抽出宝贵的时间阅读本文.

解决方法:

如果您只是想查找包含非ASCII字符的列,则可以使用以下查询

选择 *
从表
WHERE列!= CONVERT(使用ASCII的列);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐