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