Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9522085

Browse files
committed
Doc: work a little harder on the initial examples for regex matching.
Writing unnecessary '.*' at start and end of a POSIX regex doesn'tdo much except confuse the reader about whether that might benecessary after all. Make the examples in table 9.16 a tad morerealistic, and try to turn the next group of examples into somethingself-contained.Per gripe from rmzgrimes. Back-patch to v13 because it's easy.Discussion:https://postgr.es/m/161215841824.14653.8969016349304314299@wrigleys.postgresql.org
1 parentf003a75 commit9522085

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

‎doc/src/sgml/func.sgml‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5329,7 +5329,7 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
53295329
String matches regular expression, case sensitively
53305330
</para>
53315331
<para>
5332-
<literal>'thomas' ~ '.*thom.*'</literal>
5332+
<literal>'thomas' ~ 't.*ma'</literal>
53335333
<returnvalue>t</returnvalue>
53345334
</para></entry>
53355335
</row>
@@ -5343,7 +5343,7 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
53435343
String matches regular expression, case insensitively
53445344
</para>
53455345
<para>
5346-
<literal>'thomas' ~* '.*Thom.*'</literal>
5346+
<literal>'thomas' ~* 'T.*ma'</literal>
53475347
<returnvalue>t</returnvalue>
53485348
</para></entry>
53495349
</row>
@@ -5357,8 +5357,8 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
53575357
String does not match regular expression, case sensitively
53585358
</para>
53595359
<para>
5360-
<literal>'thomas' !~ '.*thomas.*'</literal>
5361-
<returnvalue>f</returnvalue>
5360+
<literal>'thomas' !~ 't.*max'</literal>
5361+
<returnvalue>t</returnvalue>
53625362
</para></entry>
53635363
</row>
53645364

@@ -5371,8 +5371,8 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
53715371
String does not match regular expression, case insensitively
53725372
</para>
53735373
<para>
5374-
<literal>'thomas' !~* '.*vadim.*'</literal>
5375-
<returnvalue>t</returnvalue>
5374+
<literal>'thomas' !~* 'T.*ma'</literal>
5375+
<returnvalue>f</returnvalue>
53765376
</para></entry>
53775377
</row>
53785378
</tbody>
@@ -5406,10 +5406,12 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
54065406
<para>
54075407
Some examples:
54085408
<programlisting>
5409-
'abc' ~ 'abc' <lineannotation>true</lineannotation>
5410-
'abc' ~ '^a' <lineannotation>true</lineannotation>
5411-
'abc' ~ '(b|d)' <lineannotation>true</lineannotation>
5412-
'abc' ~ '^(b|c)' <lineannotation>false</lineannotation>
5409+
'abcd' ~ 'bc' <lineannotation>true</lineannotation>
5410+
'abcd' ~ 'a.c' <lineannotation>true &mdash; dot matches any character</lineannotation>
5411+
'abcd' ~ 'a.*d' <lineannotation>true &mdash; <literal>*</literal> repeats the preceding pattern item</lineannotation>
5412+
'abcd' ~ '(b|x)' <lineannotation>true &mdash; <literal>|</literal> means OR, parentheses group</lineannotation>
5413+
'abcd' ~ '^a' <lineannotation>true &mdash; <literal>^</literal> anchors to start of string</lineannotation>
5414+
'abcd' ~ '^(b|c)' <lineannotation>false &mdash; would match except for anchoring</lineannotation>
54135415
</programlisting>
54145416
</para>
54155417

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp