Determine if a column contains special characters in a postgresql table

I have a table in PostgreSQL, and I need to determine if the column contains special characters like #,$,^,&,*,@,! etc. or empty.

For example, a table might look like this:

enter image description here

How to write such a request?

+4
source share
1 answer

Finally, I got a solution

 select * from table where column1 ~* '[^a-z0-9]' or column2 ~* '[^a-z0-9]' or column3 ~* '[^a-z0-9]' 
+9
source

Source: https://habr.com/ru/post/1439815/


All Articles