treatment for a trailing newline,
the addition of complemented bracket expressions to the things
affected by newline-sensitive matching,
the restrictions on parentheses and back references in lookahead/lookbehind
constraints, and the longest/shortest-match (rather than first-match)
matching semantics.
</para>
</sect3>
<sect3 id="posix-basic-regexes">
<title>Basic Regular Expressions</title>
<para>
BREs differ from EREs in several respects.
In BREs, <literal>|</literal>, <literal>+</literal>, and <literal>?</literal>
are ordinary characters and there is no equivalent
for their functionality.
The delimiters for bounds are
<literal>\{</literal> and <literal>\}</literal>,
with <literal>{</literal> and <literal>}</literal>
by themselves ordinary characters.
The parentheses for nested subexpressions are
<literal>\(</literal> and <literal>\)</literal>,
with <literal>(</literal> and <literal>)</literal> by themselves ordinary characters.
<literal>^</literal> is an ordinary character except at the beginning of the
RE or the beginning of a parenthesized subexpression,
<literal>$</literal> is an ordinary character except at the end of the
RE or the end of a parenthesized subexpression,
and <literal>*</literal> is an ordinary character if it appears at the beginning
of the RE or the beginning of a parenthesized subexpression
(after a possible leading <literal>^</literal>).
Finally, single-digit back references are available, and
<literal>\<</literal> and <literal>\></literal>
are synonyms for
<literal>[[:<:]]</literal> and <literal>[[:>:]]</literal>
respectively; no other escapes are available in BREs.
</para>
</sect3>
<!-- end re_syntax.n man page -->
<sect3 id="posix-vs-xquery">
<title>Differences from SQL Standard and XQuery</title>
<indexterm zone="posix-vs-xquery">
<primary>LIKE_REGEX</primary>
</indexterm>
<indexterm zone="posix-vs-xquery">
<primary>OCCURRENCES_REGEX</primary>
</indexterm>
<indexterm zone="posix-vs-xquery">
<primary>POSITION_REGEX</primary>
</indexterm>
<indexterm zone="posix-vs-xquery">
<primary>SUBSTRING_REGEX</primary>
</indexterm>
<indexterm zone="posix-vs-xquery">
<primary>TRANSLATE_REGEX</primary>
</indexterm>
<indexterm zone="posix-vs-xquery">
<primary>XQuery regular expressions</primary>
</indexterm>
<para>
Since SQL:2008, the SQL standard includes regular expression operators
and functions that performs pattern
matching according to the XQuery regular expression
standard:
<itemizedlist>
<listitem><para><literal>LIKE_REGEX</literal></para></listitem>
<listitem><para><literal>OCCURRENCES_REGEX</literal></para></listitem>
<listitem><para><literal>POSITION_REGEX</literal></para></listitem>
<listitem><para><literal>SUBSTRING_REGEX</literal></para></listitem>
<listitem><para><literal>TRANSLATE_REGEX</literal></para></listitem>
</itemizedlist>
<productname>PostgreSQL</productname> does not currently implement these
operators and functions. You can get approximately equivalent
functionality in each case as shown in <xref
linkend="functions-regexp-sql-table"/>. (Various optional clauses on
both sides have been omitted in this table.)
</para>
<table id="functions-regexp-sql-table">
<title>Regular Expression Functions Equivalencies</title>
<tgroup cols="2">
<thead>
<row>
<entry>SQL standard</entry>
<entry><productname>PostgreSQL</productname></entry>
</row>
</thead>
<tbody>
<row>
<entry><literal><replaceable>string</replaceable> LIKE_REGEX <replaceable>pattern</replaceable></literal></entry>
<entry><literal>regexp_like(<replaceable>string</replaceable>, <replaceable>pattern</replaceable>)</literal> or <literal><replaceable>string</replaceable>