1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.137 2003/02/05 17:41:32 tgl Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.138 2003/02/06 20:25:31 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -2665,10 +2665,24 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
2665
2665
due to their availability in programming languages such as Perl and Tcl.
2666
2666
<acronym>RE</acronym>s using these non-POSIX extensions are called
2667
2667
<firstterm>advanced</> <acronym>RE</acronym>s or <acronym>ARE</>s
2668
- in this documentation. We first describe the ERE/ARE flavor and then
2669
- mention the restrictions of the BRE form.
2668
+ in this documentation. AREs are almost an exact superset of EREs,
2669
+ but BREs have several notational incompatibilities (as well as being
2670
+ much more limited).
2671
+ We first describe the ARE and ERE forms, noting features that apply
2672
+ only to AREs, and then describe how BREs differ.
2670
2673
</para>
2671
2674
2675
+ <note>
2676
+ <para>
2677
+ The form of regular expressions accepted by <productname>PostgreSQL</>
2678
+ can be chosen by setting the <varname>REGEX_FLAVOR</> run-time parameter
2679
+ (described in the &cite-admin;). The usual setting is
2680
+ <literal>advanced</>, but one might choose <literal>extended</> for
2681
+ maximum backwards compatibility with pre-7.4 releases of
2682
+ <productname>PostgreSQL</>.
2683
+ </para>
2684
+ </note>
2685
+
2672
2686
<para>
2673
2687
A regular expression is defined as one or more
2674
2688
<firstterm>branches</firstterm>, separated by
@@ -2784,7 +2798,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
2784
2798
meaning in <productname>PostgreSQL</> string literals.
2785
2799
To write a pattern constant that contains a backslash,
2786
2800
you must write two backslashes in the query.
2787
- </para>
2801
+ </para>
2788
2802
</note>
2789
2803
2790
2804
<table id="posix-quantifiers-table">
@@ -3392,11 +3406,11 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3392
3406
</para>
3393
3407
3394
3408
<para>
3395
- Normally the flavor of RE being used is specified by
3396
- application-dependent means .
3397
- However, this can be overridden by a <firstterm>director</>.
3409
+ Normally the flavor of RE being used is determined by
3410
+ <varname>REGEX_FLAVOR</> .
3411
+ However, this can be overridden by a <firstterm>director</> prefix .
3398
3412
If an RE of any flavor begins with <literal>***:</>,
3399
- the rest of the RE is an ARE.
3413
+ the rest of the RE is taken as an ARE.
3400
3414
If an RE of any flavor begins with <literal>***=</>,
3401
3415
the rest of the RE is taken to be a literal string,
3402
3416
with all characters considered ordinary characters.
@@ -3407,8 +3421,8 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3407
3421
a sequence <literal>(?</><replaceable>xyz</><literal>)</>
3408
3422
(where <replaceable>xyz</> is one or more alphabetic characters)
3409
3423
specifies options affecting the rest of the RE.
3410
- These supplement, and can override,
3411
- any options specified externally .
3424
+ These options override any previously determined options (including
3425
+ both the RE flavor and case sensitivity) .
3412
3426
The available option letters are
3413
3427
shown in <xref linkend="posix-embedded-options-table">.
3414
3428
</para>
@@ -3432,7 +3446,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3432
3446
3433
3447
<row>
3434
3448
<entry> <literal>c</> </entry>
3435
- <entry> case-sensitive matching (usual default ) </entry>
3449
+ <entry> case-sensitive matching (overrides operator type ) </entry>
3436
3450
</row>
3437
3451
3438
3452
<row>
@@ -3443,7 +3457,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3443
3457
<row>
3444
3458
<entry> <literal>i</> </entry>
3445
3459
<entry> case-insensitive matching (see
3446
- <xref linkend="posix-matching-rules">) </entry>
3460
+ <xref linkend="posix-matching-rules">) (overrides operator type) </entry>
3447
3461
</row>
3448
3462
3449
3463
<row>
@@ -3471,12 +3485,12 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3471
3485
3472
3486
<row>
3473
3487
<entry> <literal>s</> </entry>
3474
- <entry> non-newline-sensitive matching (usual default) </entry>
3488
+ <entry> non-newline-sensitive matching (default) </entry>
3475
3489
</row>
3476
3490
3477
3491
<row>
3478
3492
<entry> <literal>t</> </entry>
3479
- <entry> tight syntax (usual default; see below) </entry>
3493
+ <entry> tight syntax (default; see below) </entry>
3480
3494
</row>
3481
3495
3482
3496
<row>
@@ -3696,7 +3710,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3696
3710
</para>
3697
3711
3698
3712
<para>
3699
- Two significant incompatibilites exist between AREs and the ERE syntax
3713
+ Two significant incompatibilities exist between AREs and the ERE syntax
3700
3714
recognized by pre-7.4 releases of <productname>PostgreSQL</>:
3701
3715
3702
3716
<itemizedlist>
@@ -3717,6 +3731,10 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
3717
3731
</para>
3718
3732
</listitem>
3719
3733
</itemizedlist>
3734
+
3735
+ While these differences are unlikely to create a problem for most
3736
+ applications, you can avoid them if necessary by
3737
+ setting <varname>REGEX_FLAVOR</> to <literal>extended</>.
3720
3738
</para>
3721
3739
</sect3>
3722
3740
0 commit comments