How do I find all rows of a PostgreSQL table that contain characters in some Unicode range, such as Cyrillic characters?
Asked
Active
Viewed 1,628 times
2 Answers
14
Figured it out! For Cyrillic:
SELECT * FROM "items" WHERE (title SIMILAR TO '%[\u0410-\u044f]%')
I got the range from http://symbolcodes.tlt.psu.edu/bylanguage/cyrillicchart.html. The characters have hex entities А to я, which are also my numbers above.
Henrik N
- 14,896
- 4
- 75
- 122
2
If you install the pgpcre extension, you can use this expression:
SELECT * FROM items WHERE title ~ pcre '\p{Cyrillic}';
Peter Eisentraut
- 33,335
- 12
- 80
- 87