Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
6a0f486a
Commit
6a0f486a
authored
24 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
A little wordsmithing in the pattern-matching section.
parent
d316f222
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/func.sgml
+54
-37
54 additions, 37 deletions
doc/src/sgml/func.sgml
with
54 additions
and
37 deletions
doc/src/sgml/func.sgml
+
54
−
37
View file @
6a0f486a
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.4
2
2000/12/16 1
8
:33:
1
3 tgl Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.4
3
2000/12/16 1
9
:33:
2
3 tgl Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
...
...
@@ -805,12 +805,12 @@
<para>
If <replaceable>pattern</replaceable> does not contain percent
signs or underscore then the pattern only represents the string
signs or underscore
,
then the pattern only represents the string
itself; in that case <function>LIKE</function> acts like the
equals operator. An underscore (<literal>_</literal>) in
<replaceable>pattern</replaceable> stands for (matches) any single
character
,
a percent sign (<literal>%</literal>) matches
zero or
more characters.
character
;
a percent sign (<literal>%</literal>) matches
any string
of zero or
more characters.
</para>
<informalexample>
...
...
@@ -827,33 +827,39 @@
<para>
<function>LIKE</function> pattern matches always cover the entire
string.
On order t
o match a pattern anywhere within a string, the
string.
T
o match a pattern anywhere within a string, the
pattern must therefore start and end with a percent sign.
</para>
<para>
In order to match a literal underscore or percent sign, the
respective character in <replaceable>pattern</replaceable> must be
preceded by the active escape character. The default escape
To match a literal underscore or percent sign without matching
other characters, the respective character in
<replaceable>pattern</replaceable> must be
preceded by the escape character. The default escape
character is the backslash but a different one may be selected by
using the <literal>ESCAPE</literal> clause. When using the
backslash as escape character in literal strings it must be
doubled, because the backslash already has a special meaning in
string literals.
using the <literal>ESCAPE</literal> clause. To match the escape
character itself, write two escape characters.
</para>
<para>
Note that the backslash already has a special meaning in string
literals, so to write a pattern constant that contains a backslash
you must write two backslashes in the query. You can avoid this by
selecting a different escape character with <literal>ESCAPE</literal>.
</para>
<para>
The keyword <token>ILIKE</token> can be used instead of
<token>LIKE</token> to make the match case insensitive according
to the active locale. This is a
to the active locale. This is
not in the SQL standard but is
a
<productname>Postgres</productname> extension.
</para>
<para>
The operator <literal>~~</literal> is equivalent to
<function>LIKE</function>, <literal>~~*</literal> corresponds to
<
literal>ILIKE</literal>. Finally, t
here are also
<literal>!~~</literal> and <literal>!~~*</literal> operators t
o
<function>LIKE</function>,
and
<literal>~~*</literal> corresponds to
<
function>ILIKE</function>. T
here are also
<literal>!~~</literal> and <literal>!~~*</literal> operators t
hat
represent <function>NOT LIKE</function> and <function>NOT
ILIKE</function>. All of these are also
<productname>Postgres</productname>-specific.
...
...
@@ -864,25 +870,6 @@
<sect2 id="functions-regexp">
<title>POSIX Regular Expressions</title>
<para>
POSIX regular expressions provide a more powerful means for
pattern matching than the <function>LIKE</function> function.
Many Unix tools such as <command>egrep</command>,
<command>sed</command>, or <command>awk</command> use a pattern
matching language that is similar to the one described here.
</para>
<para>
A regular expression is a character sequence that is an
abbreviated definition of a set of strings (a <firstterm>regular
set</firstterm>). A string is said to match a regular expression
if it is a member of the regular set described by the regular
expression. Unlike the <function>LIKE</function> operator, a
regular expression also matches anywhere within a string, unless
the regular expression is explicitly anchored to the beginning or
end of the string.
</para>
<table>
<title>Regular Expression Match Operators</title>
...
...
@@ -920,6 +907,29 @@
</tgroup>
</table>
<para>
POSIX regular expressions provide a more powerful means for
pattern matching than the <function>LIKE</function> function.
Many Unix tools such as <command>egrep</command>,
<command>sed</command>, or <command>awk</command> use a pattern
matching language that is similar to the one described here.
</para>
<para>
A regular expression is a character sequence that is an
abbreviated definition of a set of strings (a <firstterm>regular
set</firstterm>). A string is said to match a regular expression
if it is a member of the regular set described by the regular
expression. As with <function>LIKE</function>, pattern characters
match string characters exactly unless they are special characters
in the regular expression language --- but regular expressions use
different special characters than <function>LIKE</function> does.
Unlike <function>LIKE</function> patterns, a
regular expression is allowed to match anywhere within a string, unless
the regular expression is explicitly anchored to the beginning or
end of the string.
</para>
<!-- derived from the re_format.7 man page -->
<para>
...
...
@@ -927,8 +937,8 @@
1003.2, come in two forms: modern REs (roughly those of
<command>egrep</command>; 1003.2 calls these
<quote>extended</quote> REs) and obsolete REs (roughly those of
<command>ed</command>; 1003.2 <quote>basic</quote> REs).
Obsolete
REs are not available in
<productname>Postgres</productname>.
<command>ed</command>; 1003.2 <quote>basic</quote> REs).
<productname>Postgres</productname>
implements the modern form
.
</para>
<para>
...
...
@@ -1004,6 +1014,13 @@
<literal>\</literal>.
</para>
<para>
Note that the backslash (<literal>\</literal>) already has a special
meaning in string
literals, so to write a pattern constant that contains a backslash
you must write two backslashes in the query.
</para>
<para>
A <firstterm>bracket expression</firstterm> is a list of
characters enclosed in <literal>[]</literal>. It normally matches
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment