String matches regular expression, case sensitively
- 'thomas' ~ '.*thom.*'
+ 'thomas' ~ 't.*ma'
t
String matches regular expression, case insensitively
- 'thomas' ~* '.*Thom.*'
+ 'thomas' ~* 'T.*ma'
t
String does not match regular expression, case sensitively
- 'thomas' !~ '.*thomas.*'
- f
+ 'thomas' !~ 't.*max'
+ t
String does not match regular expression, case insensitively
- 'thomas' !~* '.*vadim.*'
- t
+ 'thomas' !~* 'T.*ma'
+ f
Some examples:
-'abc' ~ 'abc' true
-'abc' ~ '^a' true
-'abc' ~ '(b|d)' true
-'abc' ~ '^(b|c)' false
+'abcd' ~ 'bc' true
+'abcd' ~ 'a.c' true — dot matches any character
+'abcd' ~ 'a.*d' true — * repeats the preceding pattern item
+'abcd' ~ '(b|x)' true — | means OR, parentheses group
+'abcd' ~ '^a' true — ^ anchors to start of string
+'abcd' ~ '^(b|c)' false — would match except for anchoring