Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql ActiveRecord使用西里尔字母字段查找元素_Mysql_Ruby On Rails_Postgresql_Activerecord_Cyrillic - Fatal编程技术网

Mysql ActiveRecord使用西里尔字母字段查找元素

Mysql ActiveRecord使用西里尔字母字段查找元素,mysql,ruby-on-rails,postgresql,activerecord,cyrillic,Mysql,Ruby On Rails,Postgresql,Activerecord,Cyrillic,我想找到所有使用西里尔字母命名的用户。我如何使用ActiveRecord进行此操作 非ActiveRecord解决方案在这里:User.all.select{User}User.name.match(/\p{Cyrillic}/)}。不幸的是,regexp/\p{Cyrillic}/不适用于sql 更新:通过下面的讨论,我意识到我需要Postgres和MySQL的解决方案。 对于postgres,它可以是SELECT*FROM“items”,其中(标题类似于“%[\u0410-\u044f]”)

我想找到所有使用西里尔字母命名的用户。我如何使用ActiveRecord进行此操作

非ActiveRecord解决方案在这里:
User.all.select{User}User.name.match(/\p{Cyrillic}/)}
。不幸的是,regexp
/\p{Cyrillic}/
不适用于sql

更新:通过下面的讨论,我意识到我需要Postgres和MySQL的解决方案。 对于postgres,它可以是
SELECT*FROM“items”,其中(标题类似于“%[\u0410-\u044f]”)


可能重复的@JagdeepSingh来看,它肯定不是该链接的重复。作者根本并没有问“如何在SQL中使用Regexp”。Alex,您必须在标记中添加DB,因为答案是特定于DB的。即,对于Postgresql-@PavelMikhailyuk,感谢Postgres解决方案。我想得到一个不特定于DB的答案,它也可以用于MySQL和Postgres;)@JagdeepSingh感谢您的链接,但它只是关于ActiveRecord查询中的regexp。我需要一个特别的。