I
I
Ivan Balan2013-12-28 06:04:47
PostgreSQL
Ivan Balan, 2013-12-28 06:04:47

How to make a selection of records in Postgres that consist only of Russian letters or English?

Actually the subject, tried hard to google, but did not find anything. Only records with Russian letters or only with English letters are needed. How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Makarov, 2013-12-28
@Toddams

This can be solved with regular expressions:

#Ищем пользователей с именем, написанным только латинскими буквами
SELECT * FROM users WHERE name ~ '[a-z]+';

#ищем с русскими буквами
SELECT * FROM users WHERE name ~ '[а-я]+';

Example on sqlfiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question