简体   繁体   English

MySQL:带有 [.character.] 的 REGEX 不再起作用('不支持 POSIX 整理元素)

[英]MySQL: REGEX with [.character.] doesnt work anymore ('POSIX collating elements are not supported)

I have an error that is driving me crazy.我有一个让我发疯的错误。 When I take the following MySQL REGEX example from the official MySQL page i get an error.当我从官方 MySQL 页面获取以下 MySQL REGEX 示例时,出现错误。 Used SQL-Statement:使用的 SQL 语句:

SELECT '~' REGEXP '[[.tilde.]]';

Error message I get:我收到的错误消息:

#1139 - Got error 'POSIX collating elements are not supported at offset 1' from regexp

Source of the example (scroll down to [.characters.]): https://dev.mysql.com/doc/refman/5.7/en/regexp.html#operator_regexp示例来源(向下滚动到 [.characters.]): https://dev.mysql.com/doc/refman/5.7/en/regexp.html#operator_regexp

By the answers above I came to the answer to my similar error... "POSIX named classes are supported only within a class" Changed my DjangoDB from Postgresql to Mysql/MariaDB and had an error because of a special search pattern in my Django App:通过上面的答案,我得出了类似错误的答案...“POSIX 命名类仅在一个类中受支持”将我的 DjangoDB 从 Postgresql 更改为 Mysql/MariaDB,并且由于我的 Django 应用程序中的特殊搜索模式而出错:

search_pattern = r'(-|[:space:]|/|[(]|[)])*%s' return Q(telefon__iregex=search) | Q(mobil__iregex=search)

I replaced it by...我把它换成...

search_pattern = r'(-| |/|[(]|[)])*%s' return Q(telefon__iregex=search) | Q(mobil__iregex=search)

fixed it.固定它。 Thus MariaDB really seems to not like the []-expressions... Thanks for the hints!因此 MariaDB 似乎真的不喜欢 []-expressions...感谢您的提示!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM