-- Gets zero or any spaces numbers and text characters before one R
SELECT * FROM table WHERE column ~ '^[\s\w]*[R]{1}$'

-- Gets zero or any spaces numbers and text characters after one R
SELECT * FROM table WHERE column ~ '^[R]{1}[\s\w]*$'

[링크 : https://stackoverflow.com/questions/46978821/postgres-regex-begins-with-and-ends-with]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

sql select if or case  (0) 2019.08.26
order by group by  (0) 2019.08.26
sql ||과 concat()  (0) 2019.08.22
pgadmin 에서 table 생성 SQL문 얻기  (0) 2019.08.20
sql substring  (0) 2019.08.16
Posted by 구차니