'PostgreSQL'에 해당되는 글 2건

  1. 2009.08.22 [PostgreSQL] POSIX 정규식
  2. 2009.08.20 [PostgreSQL] String 자르고 합치기

[PostgreSQL] POSIX 정규식

DB 2009. 8. 22. 14:28

Table 9-11. Regular Expression Match Operators

Operator Description Example
~ Matches regular expression, case sensitive 'thomas' ~ '.*thomas.*'
~* Matches regular expression, case insensitive 'thomas' ~* '.*Thomas.*'
!~ Does not match regular expression, case sensitive 'thomas' !~ '.*Thomas.*'
!~* Does not match regular expression, case insensitive 'thomas' !~* '.*vadim.*'

sensitive: 대소문자 구분
insensitive: 대소문자 비구분

POSIX정규식은  LIKE나 SIMILAR TO 연산자보다 패턴매칭에 더 효과적인 수단이다. egrep, sed 또는 awk와 같은 유닉스 툴은 여기서 기술된 것과 유사한 패턴매칭 언어를 사용한다.
설명보기
Posted by zeide
,
1. 자르기
SUBSTRING(string from num1 for num2)
string에서 num1부터 시작해서 num2의 문자를 자른다.

SUBSTRING('helloworld' from 3 for 3)
>'llo'

2. 합치기
string1 || string2
string1과 string2를 합친다.

'hello' || 'world'
>'helloworld'

참고
Posted by zeide
,