首页 > 代码库 > postgres 正则表达式

postgres 正则表达式

PostgreSQL正则表达式

基础:

 

OperatorDescriptionExample
~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.*‘

 

注意:~相当于like

Some examples:

 

‘abc‘ ~ ‘abc‘    true‘abc‘ ~ ‘^a‘     true‘abc‘ ~ ‘(b|d)‘  true‘abc‘ ~ ‘^(b|c)‘ false