16af9a77bSJohn Marino.\" Copyright (c) 1992, 1993, 1994 Henry Spencer. 26af9a77bSJohn Marino.\" Copyright (c) 1992, 1993, 1994 36af9a77bSJohn Marino.\" The Regents of the University of California. All rights reserved. 46af9a77bSJohn Marino.\" 56af9a77bSJohn Marino.\" This code is derived from software contributed to Berkeley by 66af9a77bSJohn Marino.\" Henry Spencer. 76af9a77bSJohn Marino.\" 86af9a77bSJohn Marino.\" Redistribution and use in source and binary forms, with or without 96af9a77bSJohn Marino.\" modification, are permitted provided that the following conditions 106af9a77bSJohn Marino.\" are met: 116af9a77bSJohn Marino.\" 1. Redistributions of source code must retain the above copyright 126af9a77bSJohn Marino.\" notice, this list of conditions and the following disclaimer. 136af9a77bSJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 146af9a77bSJohn Marino.\" notice, this list of conditions and the following disclaimer in the 156af9a77bSJohn Marino.\" documentation and/or other materials provided with the distribution. 166af9a77bSJohn Marino.\" 3. Neither the name of the University nor the names of its contributors 176af9a77bSJohn Marino.\" may be used to endorse or promote products derived from this software 186af9a77bSJohn Marino.\" without specific prior written permission. 196af9a77bSJohn Marino.\" 206af9a77bSJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 216af9a77bSJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 226af9a77bSJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 236af9a77bSJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 246af9a77bSJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 256af9a77bSJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 266af9a77bSJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 276af9a77bSJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 286af9a77bSJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 296af9a77bSJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 306af9a77bSJohn Marino.\" SUCH DAMAGE. 316af9a77bSJohn Marino.\" 326af9a77bSJohn Marino.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94 336af9a77bSJohn Marino.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.12 2008/09/05 17:41:20 keramida Exp $ 346af9a77bSJohn Marino.\" 356af9a77bSJohn Marino.Dd August 6, 2015 366af9a77bSJohn Marino.Dt RE_FORMAT 7 376af9a77bSJohn Marino.Os 386af9a77bSJohn Marino.Sh NAME 396af9a77bSJohn Marino.Nm re_format 406af9a77bSJohn Marino.Nd POSIX 1003.2 regular expressions 416af9a77bSJohn Marino.Sh DESCRIPTION 426af9a77bSJohn MarinoRegular expressions 436af9a77bSJohn Marino.Pq Dq RE Ns s , 446af9a77bSJohn Marinoas defined in 456af9a77bSJohn Marino.St -p1003.2 , 466af9a77bSJohn Marinocome in two forms: 476af9a77bSJohn Marinomodern REs (roughly those of 486af9a77bSJohn Marino.Xr egrep 1 ; 496af9a77bSJohn Marino1003.2 calls these 506af9a77bSJohn Marino.Dq extended 516af9a77bSJohn MarinoREs) 526af9a77bSJohn Marinoand obsolete REs (roughly those of 536af9a77bSJohn Marino.Xr ed 1 ; 546af9a77bSJohn Marino1003.2 556af9a77bSJohn Marino.Dq basic 566af9a77bSJohn MarinoREs). 576af9a77bSJohn MarinoObsolete REs mostly exist for backward compatibility in some old programs; 586af9a77bSJohn Marinothey will be discussed at the end. 596af9a77bSJohn Marino.St -p1003.2 606af9a77bSJohn Marinoleaves some aspects of RE syntax and semantics open; 616af9a77bSJohn Marino`\(dd' marks decisions on these aspects that 626af9a77bSJohn Marinomay not be fully portable to other 636af9a77bSJohn Marino.St -p1003.2 646af9a77bSJohn Marinoimplementations. 656af9a77bSJohn Marino.Pp 666af9a77bSJohn MarinoA (modern) RE is one\(dd or more non-empty\(dd 676af9a77bSJohn Marino.Em branches , 686af9a77bSJohn Marinoseparated by 696af9a77bSJohn Marino.Ql \&| . 706af9a77bSJohn MarinoIt matches anything that matches one of the branches. 716af9a77bSJohn Marino.Pp 726af9a77bSJohn MarinoA branch is one\(dd or more 736af9a77bSJohn Marino.Em pieces , 746af9a77bSJohn Marinoconcatenated. 756af9a77bSJohn MarinoIt matches a match for the first, followed by a match for the second, etc. 766af9a77bSJohn Marino.Pp 776af9a77bSJohn MarinoA piece is an 786af9a77bSJohn Marino.Em atom 796af9a77bSJohn Marinopossibly followed 806af9a77bSJohn Marinoby a single\(dd 816af9a77bSJohn Marino.Ql \&* , 826af9a77bSJohn Marino.Ql \&+ , 836af9a77bSJohn Marino.Ql \&? , 846af9a77bSJohn Marinoor 856af9a77bSJohn Marino.Em bound . 866af9a77bSJohn MarinoAn atom followed by 876af9a77bSJohn Marino.Ql \&* 886af9a77bSJohn Marinomatches a sequence of 0 or more matches of the atom. 896af9a77bSJohn MarinoAn atom followed by 906af9a77bSJohn Marino.Ql \&+ 916af9a77bSJohn Marinomatches a sequence of 1 or more matches of the atom. 926af9a77bSJohn MarinoAn atom followed by 936af9a77bSJohn Marino.Ql ?\& 946af9a77bSJohn Marinomatches a sequence of 0 or 1 matches of the atom. 956af9a77bSJohn Marino.Pp 966af9a77bSJohn MarinoA 976af9a77bSJohn Marino.Em bound 986af9a77bSJohn Marinois 996af9a77bSJohn Marino.Ql \&{ 1006af9a77bSJohn Marinofollowed by an unsigned decimal integer, 1016af9a77bSJohn Marinopossibly followed by 1026af9a77bSJohn Marino.Ql \&, 1036af9a77bSJohn Marinopossibly followed by another unsigned decimal integer, 1046af9a77bSJohn Marinoalways followed by 1056af9a77bSJohn Marino.Ql \&} . 1066af9a77bSJohn MarinoThe integers must lie between 0 and 1076af9a77bSJohn Marino.Dv RE_DUP_MAX 1086af9a77bSJohn Marino(255\(dd) inclusive, 1096af9a77bSJohn Marinoand if there are two of them, the first may not exceed the second. 1106af9a77bSJohn MarinoAn atom followed by a bound containing one integer 1116af9a77bSJohn Marino.Em i 1126af9a77bSJohn Marinoand no comma matches 1136af9a77bSJohn Marinoa sequence of exactly 1146af9a77bSJohn Marino.Em i 1156af9a77bSJohn Marinomatches of the atom. 1166af9a77bSJohn MarinoAn atom followed by a bound 1176af9a77bSJohn Marinocontaining one integer 1186af9a77bSJohn Marino.Em i 1196af9a77bSJohn Marinoand a comma matches 1206af9a77bSJohn Marinoa sequence of 1216af9a77bSJohn Marino.Em i 1226af9a77bSJohn Marinoor more matches of the atom. 1236af9a77bSJohn MarinoAn atom followed by a bound 1246af9a77bSJohn Marinocontaining two integers 1256af9a77bSJohn Marino.Em i 1266af9a77bSJohn Marinoand 1276af9a77bSJohn Marino.Em j 1286af9a77bSJohn Marinomatches 1296af9a77bSJohn Marinoa sequence of 1306af9a77bSJohn Marino.Em i 1316af9a77bSJohn Marinothrough 1326af9a77bSJohn Marino.Em j 1336af9a77bSJohn Marino(inclusive) matches of the atom. 1346af9a77bSJohn Marino.Pp 1356af9a77bSJohn MarinoAn atom is a regular expression enclosed in 1366af9a77bSJohn Marino.Ql () 1376af9a77bSJohn Marino(matching a match for the 1386af9a77bSJohn Marinoregular expression), 1396af9a77bSJohn Marinoan empty set of 1406af9a77bSJohn Marino.Ql () 1416af9a77bSJohn Marino(matching the null string)\(dd, 1426af9a77bSJohn Marinoa 1436af9a77bSJohn Marino.Em bracket expression 1446af9a77bSJohn Marino(see below), 1456af9a77bSJohn Marino.Ql .\& 1466af9a77bSJohn Marino(matching any single character), 1476af9a77bSJohn Marino.Ql \&^ 1486af9a77bSJohn Marino(matching the null string at the beginning of a line), 1496af9a77bSJohn Marino.Ql \&$ 1506af9a77bSJohn Marino(matching the null string at the end of a line), a 1516af9a77bSJohn Marino.Ql \e 1526af9a77bSJohn Marinofollowed by one of the characters 1536af9a77bSJohn Marino.Ql ^.[$()|*+?{\e 1546af9a77bSJohn Marino(matching that character taken as an ordinary character), 1556af9a77bSJohn Marinoa 1566af9a77bSJohn Marino.Ql \e 1576af9a77bSJohn Marinofollowed by any other character\(dd 1586af9a77bSJohn Marino(matching that character taken as an ordinary character, 1596af9a77bSJohn Marinoas if the 1606af9a77bSJohn Marino.Ql \e 1616af9a77bSJohn Marinohad not been present\(dd), 1626af9a77bSJohn Marinoor a single character with no other significance (matching that character). 1636af9a77bSJohn MarinoA 1646af9a77bSJohn Marino.Ql \&{ 1656af9a77bSJohn Marinofollowed by a character other than a digit is an ordinary 1666af9a77bSJohn Marinocharacter, not the beginning of a bound\(dd. 1676af9a77bSJohn MarinoIt is illegal to end an RE with 1686af9a77bSJohn Marino.Ql \e . 1696af9a77bSJohn Marino.Pp 1706af9a77bSJohn MarinoA 1716af9a77bSJohn Marino.Em bracket expression 1726af9a77bSJohn Marinois a list of characters enclosed in 1736af9a77bSJohn Marino.Ql [] . 1746af9a77bSJohn MarinoIt normally matches any single character from the list (but see below). 1756af9a77bSJohn MarinoIf the list begins with 1766af9a77bSJohn Marino.Ql \&^ , 1776af9a77bSJohn Marinoit matches any single character 1786af9a77bSJohn Marino(but see below) 1796af9a77bSJohn Marino.Em not 1806af9a77bSJohn Marinofrom the rest of the list. 1816af9a77bSJohn MarinoIf two characters in the list are separated by 1826af9a77bSJohn Marino.Ql \&- , 1836af9a77bSJohn Marinothis is shorthand 1846af9a77bSJohn Marinofor the full 1856af9a77bSJohn Marino.Em range 1866af9a77bSJohn Marinoof characters between those two (inclusive) in the 1876af9a77bSJohn Marinocollating sequence, 1886af9a77bSJohn Marino.No e.g. Ql [0-9] 1896af9a77bSJohn Marinoin ASCII matches any decimal digit. 1906af9a77bSJohn MarinoIt is illegal\(dd for two ranges to share an 1916af9a77bSJohn Marinoendpoint, 1926af9a77bSJohn Marino.No e.g. Ql a-c-e . 1936af9a77bSJohn MarinoRanges are very collating-sequence-dependent, 1946af9a77bSJohn Marinoand portable programs should avoid relying on them. 1956af9a77bSJohn Marino.Pp 1966af9a77bSJohn MarinoTo include a literal 1976af9a77bSJohn Marino.Ql \&] 1986af9a77bSJohn Marinoin the list, make it the first character 1996af9a77bSJohn Marino(following a possible 2006af9a77bSJohn Marino.Ql \&^ ) . 2016af9a77bSJohn MarinoTo include a literal 2026af9a77bSJohn Marino.Ql \&- , 2036af9a77bSJohn Marinomake it the first or last character, 2046af9a77bSJohn Marinoor the second endpoint of a range. 2056af9a77bSJohn MarinoTo use a literal 2066af9a77bSJohn Marino.Ql \&- 2076af9a77bSJohn Marinoas the first endpoint of a range, 2086af9a77bSJohn Marinoenclose it in 2096af9a77bSJohn Marino.Ql [.\& 2106af9a77bSJohn Marinoand 2116af9a77bSJohn Marino.Ql .]\& 2126af9a77bSJohn Marinoto make it a collating element (see below). 2136af9a77bSJohn MarinoWith the exception of these and some combinations using 2146af9a77bSJohn Marino.Ql \&[ 2156af9a77bSJohn Marino(see next paragraphs), all other special characters, including 2166af9a77bSJohn Marino.Ql \e , 2176af9a77bSJohn Marinolose their special significance within a bracket expression. 2186af9a77bSJohn Marino.Pp 2196af9a77bSJohn MarinoWithin a bracket expression, a collating element (a character, 220*b827281dSSascha Wildnera multi-character sequence that collates as if it were a single character, 2216af9a77bSJohn Marinoor a collating-sequence name for either) 2226af9a77bSJohn Marinoenclosed in 2236af9a77bSJohn Marino.Ql [.\& 2246af9a77bSJohn Marinoand 2256af9a77bSJohn Marino.Ql .]\& 2266af9a77bSJohn Marinostands for the 2276af9a77bSJohn Marinosequence of characters of that collating element. 2286af9a77bSJohn MarinoThe sequence is a single element of the bracket expression's list. 2296af9a77bSJohn MarinoA bracket expression containing a multi-character collating element 2306af9a77bSJohn Marinocan thus match more than one character, 2316af9a77bSJohn Marinoe.g.\& if the collating sequence includes a 2326af9a77bSJohn Marino.Ql ch 2336af9a77bSJohn Marinocollating element, 2346af9a77bSJohn Marinothen the RE 2356af9a77bSJohn Marino.Ql [[.ch.]]*c 2366af9a77bSJohn Marinomatches the first five characters 2376af9a77bSJohn Marinoof 2386af9a77bSJohn Marino.Ql chchcc . 2396af9a77bSJohn Marino.Pp 2406af9a77bSJohn MarinoWithin a bracket expression, a collating element enclosed in 2416af9a77bSJohn Marino.Ql [= 2426af9a77bSJohn Marinoand 2436af9a77bSJohn Marino.Ql =] 2446af9a77bSJohn Marinois an equivalence class, standing for the sequences of characters 2456af9a77bSJohn Marinoof all collating elements equivalent to that one, including itself. 2466af9a77bSJohn Marino(If there are no other equivalent collating elements, 2476af9a77bSJohn Marinothe treatment is as if the enclosing delimiters were 2486af9a77bSJohn Marino.Ql [.\& 2496af9a77bSJohn Marinoand 2506af9a77bSJohn Marino.Ql .] . ) 2516af9a77bSJohn MarinoFor example, if 2526af9a77bSJohn Marino.Ql x 2536af9a77bSJohn Marinoand 2546af9a77bSJohn Marino.Ql y 2556af9a77bSJohn Marinoare the members of an equivalence class, 2566af9a77bSJohn Marinothen 2576af9a77bSJohn Marino.Ql [[=x=]] , 2586af9a77bSJohn Marino.Ql [[=y=]] , 2596af9a77bSJohn Marinoand 2606af9a77bSJohn Marino.Ql [xy] 2616af9a77bSJohn Marinoare all synonymous. 2626af9a77bSJohn MarinoAn equivalence class may not\(dd be an endpoint 2636af9a77bSJohn Marinoof a range. 2646af9a77bSJohn Marino.Pp 2656af9a77bSJohn MarinoWithin a bracket expression, the name of a 2666af9a77bSJohn Marino.Em character class 2676af9a77bSJohn Marinoenclosed in 2686af9a77bSJohn Marino.Ql [: 2696af9a77bSJohn Marinoand 2706af9a77bSJohn Marino.Ql :] 2716af9a77bSJohn Marinostands for the list of all characters belonging to that 2726af9a77bSJohn Marinoclass. 2736af9a77bSJohn MarinoStandard character class names are: 2746af9a77bSJohn Marino.Bl -column "alnum" "digit" "xdigit" -offset indent 2756af9a77bSJohn Marino.It Em "alnum digit punct" 2766af9a77bSJohn Marino.It Em "alpha graph space" 2776af9a77bSJohn Marino.It Em "blank lower upper" 2786af9a77bSJohn Marino.It Em "cntrl print xdigit" 2796af9a77bSJohn Marino.El 2806af9a77bSJohn Marino.Pp 2816af9a77bSJohn MarinoThese stand for the character classes defined in 2826af9a77bSJohn Marino.Xr ctype 3 . 2836af9a77bSJohn MarinoA locale may provide others. 2846af9a77bSJohn MarinoA character class may not be used as an endpoint of a range. 2856af9a77bSJohn Marino.Pp 2866af9a77bSJohn MarinoA bracketed expression like 2876af9a77bSJohn Marino.Ql [[:class:]] 2886af9a77bSJohn Marinocan be used to match a single character that belongs to a character 2896af9a77bSJohn Marinoclass. 2906af9a77bSJohn MarinoThe reverse, matching any character that does not belong to a specific 2916af9a77bSJohn Marinoclass, the negation operator of bracket expressions may be used: 2926af9a77bSJohn Marino.Ql [^[:class:]] . 2936af9a77bSJohn Marino.Pp 2946af9a77bSJohn MarinoThere are two special cases\(dd of bracket expressions: 2956af9a77bSJohn Marinothe bracket expressions 2966af9a77bSJohn Marino.Ql [[:<:]] 2976af9a77bSJohn Marinoand 2986af9a77bSJohn Marino.Ql [[:>:]] 2996af9a77bSJohn Marinomatch the null string at the beginning and end of a word respectively. 3006af9a77bSJohn MarinoA word is defined as a sequence of word characters 3016af9a77bSJohn Marinowhich is neither preceded nor followed by 3026af9a77bSJohn Marinoword characters. 3036af9a77bSJohn MarinoA word character is an 3046af9a77bSJohn Marino.Em alnum 3056af9a77bSJohn Marinocharacter (as defined by 3066af9a77bSJohn Marino.Xr ctype 3 ) 3076af9a77bSJohn Marinoor an underscore. 3086af9a77bSJohn MarinoThis is an extension, 3096af9a77bSJohn Marinocompatible with but not specified by 3106af9a77bSJohn Marino.St -p1003.2 , 3116af9a77bSJohn Marinoand should be used with 3126af9a77bSJohn Marinocaution in software intended to be portable to other systems. 3136af9a77bSJohn Marino.Pp 3146af9a77bSJohn MarinoIn the event that an RE could match more than one substring of a given 3156af9a77bSJohn Marinostring, 3166af9a77bSJohn Marinothe RE matches the one starting earliest in the string. 3176af9a77bSJohn MarinoIf the RE could match more than one substring starting at that point, 3186af9a77bSJohn Marinoit matches the longest. 3196af9a77bSJohn MarinoSubexpressions also match the longest possible substrings, subject to 3206af9a77bSJohn Marinothe constraint that the whole match be as long as possible, 3216af9a77bSJohn Marinowith subexpressions starting earlier in the RE taking priority over 3226af9a77bSJohn Marinoones starting later. 3236af9a77bSJohn MarinoNote that higher-level subexpressions thus take priority over 3246af9a77bSJohn Marinotheir lower-level component subexpressions. 3256af9a77bSJohn Marino.Pp 3266af9a77bSJohn MarinoMatch lengths are measured in characters, not collating elements. 3276af9a77bSJohn MarinoA null string is considered longer than no match at all. 3286af9a77bSJohn MarinoFor example, 3296af9a77bSJohn Marino.Ql bb* 3306af9a77bSJohn Marinomatches the three middle characters of 3316af9a77bSJohn Marino.Ql abbbc , 3326af9a77bSJohn Marino.Ql (wee|week)(knights|nights) 3336af9a77bSJohn Marinomatches all ten characters of 3346af9a77bSJohn Marino.Ql weeknights , 3356af9a77bSJohn Marinowhen 3366af9a77bSJohn Marino.Ql (.*).*\& 3376af9a77bSJohn Marinois matched against 3386af9a77bSJohn Marino.Ql abc 3396af9a77bSJohn Marinothe parenthesized subexpression 3406af9a77bSJohn Marinomatches all three characters, and 3416af9a77bSJohn Marinowhen 3426af9a77bSJohn Marino.Ql (a*)* 3436af9a77bSJohn Marinois matched against 3446af9a77bSJohn Marino.Ql bc 3456af9a77bSJohn Marinoboth the whole RE and the parenthesized 3466af9a77bSJohn Marinosubexpression match the null string. 3476af9a77bSJohn Marino.Pp 3486af9a77bSJohn MarinoIf case-independent matching is specified, 3496af9a77bSJohn Marinothe effect is much as if all case distinctions had vanished from the 3506af9a77bSJohn Marinoalphabet. 3516af9a77bSJohn MarinoWhen an alphabetic that exists in multiple cases appears as an 3526af9a77bSJohn Marinoordinary character outside a bracket expression, it is effectively 3536af9a77bSJohn Marinotransformed into a bracket expression containing both cases, 3546af9a77bSJohn Marino.No e.g. Ql x 3556af9a77bSJohn Marinobecomes 3566af9a77bSJohn Marino.Ql [xX] . 3576af9a77bSJohn MarinoWhen it appears inside a bracket expression, all case counterparts 3586af9a77bSJohn Marinoof it are added to the bracket expression, so that (e.g.) 3596af9a77bSJohn Marino.Ql [x] 3606af9a77bSJohn Marinobecomes 3616af9a77bSJohn Marino.Ql [xX] 3626af9a77bSJohn Marinoand 3636af9a77bSJohn Marino.Ql [^x] 3646af9a77bSJohn Marinobecomes 3656af9a77bSJohn Marino.Ql [^xX] . 3666af9a77bSJohn Marino.Pp 3676af9a77bSJohn MarinoNo particular limit is imposed on the length of REs\(dd. 3686af9a77bSJohn MarinoPrograms intended to be portable should not employ REs longer 3696af9a77bSJohn Marinothan 256 bytes, 3706af9a77bSJohn Marinoas an implementation can refuse to accept such REs and remain 3716af9a77bSJohn MarinoPOSIX-compliant. 3726af9a77bSJohn Marino.Pp 3736af9a77bSJohn MarinoObsolete 3746af9a77bSJohn Marino.Pq Dq basic 3756af9a77bSJohn Marinoregular expressions differ in several respects. 3766af9a77bSJohn Marino.Ql \&| 3776af9a77bSJohn Marinois an ordinary character and there is no equivalent 3786af9a77bSJohn Marinofor its functionality. 3796af9a77bSJohn Marino.Ql \&+ 3806af9a77bSJohn Marinoand 3816af9a77bSJohn Marino.Ql ?\& 3826af9a77bSJohn Marinoare ordinary characters, and their functionality 3836af9a77bSJohn Marinocan be expressed using bounds 3846af9a77bSJohn Marino.No ( Ql {1,} 3856af9a77bSJohn Marinoor 3866af9a77bSJohn Marino.Ql {0,1} 3876af9a77bSJohn Marinorespectively). 3886af9a77bSJohn MarinoAlso note that 3896af9a77bSJohn Marino.Ql x+ 3906af9a77bSJohn Marinoin modern REs is equivalent to 3916af9a77bSJohn Marino.Ql xx* . 3926af9a77bSJohn MarinoThe delimiters for bounds are 3936af9a77bSJohn Marino.Ql \e{ 3946af9a77bSJohn Marinoand 3956af9a77bSJohn Marino.Ql \e} , 3966af9a77bSJohn Marinowith 3976af9a77bSJohn Marino.Ql \&{ 3986af9a77bSJohn Marinoand 3996af9a77bSJohn Marino.Ql \&} 4006af9a77bSJohn Marinoby themselves ordinary characters. 4016af9a77bSJohn MarinoThe parentheses for nested subexpressions are 4026af9a77bSJohn Marino.Ql \e( 4036af9a77bSJohn Marinoand 4046af9a77bSJohn Marino.Ql \e) , 4056af9a77bSJohn Marinowith 4066af9a77bSJohn Marino.Ql \&( 4076af9a77bSJohn Marinoand 4086af9a77bSJohn Marino.Ql \&) 4096af9a77bSJohn Marinoby themselves ordinary characters. 4106af9a77bSJohn Marino.Ql \&^ 4116af9a77bSJohn Marinois an ordinary character except at the beginning of the 4126af9a77bSJohn MarinoRE or\(dd the beginning of a parenthesized subexpression, 4136af9a77bSJohn Marino.Ql \&$ 4146af9a77bSJohn Marinois an ordinary character except at the end of the 4156af9a77bSJohn MarinoRE or\(dd the end of a parenthesized subexpression, 4166af9a77bSJohn Marinoand 4176af9a77bSJohn Marino.Ql \&* 4186af9a77bSJohn Marinois an ordinary character if it appears at the beginning of the 4196af9a77bSJohn MarinoRE or the beginning of a parenthesized subexpression 4206af9a77bSJohn Marino(after a possible leading 4216af9a77bSJohn Marino.Ql \&^ ) . 4226af9a77bSJohn MarinoFinally, there is one new type of atom, a 4236af9a77bSJohn Marino.Em back reference : 4246af9a77bSJohn Marino.Ql \e 4256af9a77bSJohn Marinofollowed by a non-zero decimal digit 4266af9a77bSJohn Marino.Em d 4276af9a77bSJohn Marinomatches the same sequence of characters 4286af9a77bSJohn Marinomatched by the 4296af9a77bSJohn Marino.Em d Ns th 4306af9a77bSJohn Marinoparenthesized subexpression 4316af9a77bSJohn Marino(numbering subexpressions by the positions of their opening parentheses, 4326af9a77bSJohn Marinoleft to right), 4336af9a77bSJohn Marinoso that (e.g.) 4346af9a77bSJohn Marino.Ql \e([bc]\e)\e1 4356af9a77bSJohn Marinomatches 4366af9a77bSJohn Marino.Ql bb 4376af9a77bSJohn Marinoor 4386af9a77bSJohn Marino.Ql cc 4396af9a77bSJohn Marinobut not 4406af9a77bSJohn Marino.Ql bc . 4416af9a77bSJohn Marino.Sh ENHANCED FEATURES 4426af9a77bSJohn MarinoWhen the 4436af9a77bSJohn Marino.Dv REG_ENHANCED 4446af9a77bSJohn Marinoflag is passed to one of the 4456af9a77bSJohn Marino.Fn regcomp 4466af9a77bSJohn Marinovariants, additional features are activated. 4476af9a77bSJohn MarinoLike the enhanced 4486af9a77bSJohn Marino.Nm regex 4496af9a77bSJohn Marinoimplementations in scripting languages such as 4506af9a77bSJohn Marino.Xr perl 1 4516af9a77bSJohn Marinoand 4526af9a77bSJohn Marino.Xr python 1 , 4536af9a77bSJohn Marinothese additional features may conflict with the 4546af9a77bSJohn Marino.St -p1003.2 4556af9a77bSJohn Marinostandards in some ways. 4566af9a77bSJohn MarinoUse this with care in situations which require portability 4576af9a77bSJohn Marino(including to past versions of the Mac OS X using the previous 4586af9a77bSJohn Marino.Nm regex 4596af9a77bSJohn Marinoimplementation). 4606af9a77bSJohn Marino.Pp 4616af9a77bSJohn MarinoFor enhanced basic REs, 4626af9a77bSJohn Marino.Ql \&+ , 4636af9a77bSJohn Marino.Ql \&? 4646af9a77bSJohn Marinoand 4656af9a77bSJohn Marino.Ql \&| 4666af9a77bSJohn Marinoremain regular characters, but 4676af9a77bSJohn Marino.Ql \e+ , 4686af9a77bSJohn Marino.Ql \e? 4696af9a77bSJohn Marinoand 4706af9a77bSJohn Marino.Ql \e| 4716af9a77bSJohn Marinohave the same special meaning as the unescaped characters do for 4726af9a77bSJohn Marinoextended REs, i.e., one or more matches, zero or one matches and alteration, 4736af9a77bSJohn Marinorespectively. 4746af9a77bSJohn MarinoFor enhanced extended REs, 4756af9a77bSJohn Marinoback references are available. 4766af9a77bSJohn MarinoAdditional enhanced features are listed below. 4776af9a77bSJohn Marino.Pp 4786af9a77bSJohn MarinoWithin a bracket expression, most characters lose their magic. 4796af9a77bSJohn MarinoThis also applies to the additional enhanced features, which don't operate 4806af9a77bSJohn Marinoinside a bracket expression. 4816af9a77bSJohn Marino.Ss Assertions (available for both enhanced basic and enhanced extended REs) 4826af9a77bSJohn MarinoIn addition to 4836af9a77bSJohn Marino.Ql \&^ 4846af9a77bSJohn Marinoand 4856af9a77bSJohn Marino.Ql \&$ 4866af9a77bSJohn Marino(the assertions that match the null string at the beginning and end of line, 4876af9a77bSJohn Marinorespectively), the following assertions become available: 4886af9a77bSJohn Marino.Bl -tag -width ".Sy \eB" -offset indent 4896af9a77bSJohn Marino.It Sy \e< 4906af9a77bSJohn MarinoMatches the null string at the beginning of a word. 4916af9a77bSJohn MarinoThis is equivalent to 4926af9a77bSJohn Marino.Ql [[:<:]] . 4936af9a77bSJohn Marino.It Sy \e> 4946af9a77bSJohn MarinoMatches the null string at the end of a word. 4956af9a77bSJohn MarinoThis is equivalent to 4966af9a77bSJohn Marino.Ql [[:>:]] . 4976af9a77bSJohn Marino.It Sy \eb 4986af9a77bSJohn MarinoMatches the null string at a word boundary (either the beginning or end of 4996af9a77bSJohn Marinoa word). 5006af9a77bSJohn Marino.It Sy \eB 5016af9a77bSJohn MarinoMatches the null string where there is no word boundary. 5026af9a77bSJohn MarinoThis is the opposite of 5036af9a77bSJohn Marino.Ql \eb . 5046af9a77bSJohn Marino.El 5056af9a77bSJohn Marino.Ss Shortcuts (available for both enhanced basic and enhanced extended REs) 5066af9a77bSJohn MarinoThe following shortcuts can be used to replace more complicated 5076af9a77bSJohn Marinobracket expressions. 5086af9a77bSJohn Marino.Bl -tag -width ".Sy \eD" -offset indent 5096af9a77bSJohn Marino.It Sy \ed 5106af9a77bSJohn MarinoMatches a digit character. 5116af9a77bSJohn MarinoThis is equivalent to 5126af9a77bSJohn Marino.Ql [[:digit:]] . 5136af9a77bSJohn Marino.It Sy \eD 5146af9a77bSJohn MarinoMatches a non-digit character. 5156af9a77bSJohn MarinoThis is equivalent to 5166af9a77bSJohn Marino.Ql [^[:digit:]] . 5176af9a77bSJohn Marino.It Sy \es 5186af9a77bSJohn MarinoMatches a space character. 5196af9a77bSJohn MarinoThis is equivalent to 5206af9a77bSJohn Marino.Ql [[:space:]] . 5216af9a77bSJohn Marino.It Sy \eS 5226af9a77bSJohn MarinoMatches a non-space character. 5236af9a77bSJohn MarinoThis is equivalent to 5246af9a77bSJohn Marino.Ql [^[:space:]] . 5256af9a77bSJohn Marino.It Sy \ew 5266af9a77bSJohn MarinoMatches a word character. 5276af9a77bSJohn MarinoThis is equivalent to 5286af9a77bSJohn Marino.Ql [[:alnum:]_] . 5296af9a77bSJohn Marino.It Sy \eW 5306af9a77bSJohn MarinoMatches a non-word character. 5316af9a77bSJohn MarinoThis is equivalent to 5326af9a77bSJohn Marino.Ql [^[:alnum:]_] . 5336af9a77bSJohn Marino.El 5346af9a77bSJohn Marino.Ss Literal Sequences (available for both enhanced basic and enhanced extended REs) 5356af9a77bSJohn MarinoLiterals are normally just ordinary characters that are matched directly. 5366af9a77bSJohn MarinoUnder enhanced mode, certain character sequences are 5376af9a77bSJohn Marinoconverted to specific literals. 5386af9a77bSJohn Marino.Bl -tag -width ".Sy \ea" -offset indent 5396af9a77bSJohn Marino.It Sy \ea 5406af9a77bSJohn MarinoThe 5416af9a77bSJohn Marino.Dq bell 5426af9a77bSJohn Marinocharacter (ASCII code 7). 5436af9a77bSJohn Marino.It Sy \ee 5446af9a77bSJohn MarinoThe 5456af9a77bSJohn Marino.Dq escape 5466af9a77bSJohn Marinocharacter (ASCII code 27). 5476af9a77bSJohn Marino.It Sy \ef 5486af9a77bSJohn MarinoThe 5496af9a77bSJohn Marino.Dq form-feed 5506af9a77bSJohn Marinocharacter (ASCII code 12). 5516af9a77bSJohn Marino.It Sy \en 5526af9a77bSJohn MarinoThe 5536af9a77bSJohn Marino.Dq new-line/line-feed 5546af9a77bSJohn Marinocharacter (ASCII code 10). 5556af9a77bSJohn Marino.It Sy \er 5566af9a77bSJohn MarinoThe 5576af9a77bSJohn Marino.Dq carriage-return 5586af9a77bSJohn Marinocharacter (ASCII code 13). 5596af9a77bSJohn Marino.It Sy \et 5606af9a77bSJohn MarinoThe 5616af9a77bSJohn Marino.Dq horizontal-tab 5626af9a77bSJohn Marinocharacter (ASCII code 9). 5636af9a77bSJohn Marino.El 5646af9a77bSJohn Marino.Pp 5656af9a77bSJohn MarinoLiterals can also be specified directly, using their wide character values. 5666af9a77bSJohn MarinoNote that when matching a multibyte character string, the string's bytes 5676af9a77bSJohn Marinoare converted to wide character before comparing. 5686af9a77bSJohn MarinoThis means that a single literal wide character value may match more than 5696af9a77bSJohn Marinoone string byte, depending on the locale's wide character encoding. 5706af9a77bSJohn Marino.Bl -tag -width ".Sy \ex{ Ns Em x.. Ns Sy \&}" -offset indent 5716af9a77bSJohn Marino.It Sy \ex Ns Em x.. 5726af9a77bSJohn MarinoAn arbitray eight-bit value. 5736af9a77bSJohn MarinoThe 5746af9a77bSJohn Marino.Em x.. 5756af9a77bSJohn Marinosequence represents zero, one or two hexadecimal digits. 5766af9a77bSJohn Marino(Note: if 5776af9a77bSJohn Marino.Em x.. 5786af9a77bSJohn Marinois less than two hexadecimal digits, and the character following this sequence 5796af9a77bSJohn Marinohappens to be a hexadecimal digit, use the (following) brace form to avoid 5806af9a77bSJohn Marinoconfusion.) 5816af9a77bSJohn Marino.It Sy \ex{ Ns Em x.. Ns Sy \&} 5826af9a77bSJohn MarinoAn arbitrary, up to 32-bit value. 5836af9a77bSJohn MarinoThe 5846af9a77bSJohn Marino.Em x.. 5856af9a77bSJohn Marinosequence is an arbitrary sequence of hexadecimal digits that is long enough 5866af9a77bSJohn Marinoto represent the necessary value. 5876af9a77bSJohn Marino.El 5886af9a77bSJohn Marino.Ss Inline Literal Mode (available for both enhanced basic and enhanced extended REs) 5896af9a77bSJohn MarinoA 5906af9a77bSJohn Marino.Ql \eQ 5916af9a77bSJohn Marinosequence causes literal 5926af9a77bSJohn Marino.Pq Dq quote 5936af9a77bSJohn Marinomode to be entered, 5946af9a77bSJohn Marinowhile 5956af9a77bSJohn Marino.Ql \eE 5966af9a77bSJohn Marinoends literal mode, and returns to normal regular expression processing. 5976af9a77bSJohn MarinoThis is similar to specifying the 5986af9a77bSJohn Marino.Dv REG_NOSPEC 5996af9a77bSJohn Marino(or 6006af9a77bSJohn Marino.Dv REG_LITERAL ) 6016af9a77bSJohn Marinooption to 6026af9a77bSJohn Marino.Fn regcomp , 6036af9a77bSJohn Marinoexcept that rather than applying to the whole RE string, it only applies to 6046af9a77bSJohn Marinothe part between the 6056af9a77bSJohn Marino.Ql \eQ 6066af9a77bSJohn Marinoand 6076af9a77bSJohn Marino.Ql \eE . 6086af9a77bSJohn MarinoNote that it is not possible to have a 6096af9a77bSJohn Marino.Ql \eE 6106af9a77bSJohn Marinoin the middle of an inline literal range, as that would terminate literal mode 6116af9a77bSJohn Marinoprematurely. 6126af9a77bSJohn Marino.Ss Minimal Repetitions (available for enhanced extended REs only) 6136af9a77bSJohn MarinoBy default, the repetition operators, 6146af9a77bSJohn Marino.Ql \&* , 6156af9a77bSJohn Marino.Em bound , 6166af9a77bSJohn Marino.Ql \&? 6176af9a77bSJohn Marinoand 6186af9a77bSJohn Marino.Ql \&+ 6196af9a77bSJohn Marinoare 6206af9a77bSJohn Marino.Em greedy ; 6216af9a77bSJohn Marinothey try to match as many times as possible. 6226af9a77bSJohn MarinoIn enhanced mode, appending a 6236af9a77bSJohn Marino.Ql \&? 6246af9a77bSJohn Marinoto a repetition operator makes it minimal (or 6256af9a77bSJohn Marino.Em ungreedy ) ; 6266af9a77bSJohn Marinoit tries to match the fewest number of times (including zero times, as 6276af9a77bSJohn Marinoappropriate). 6286af9a77bSJohn Marino.Pp 6296af9a77bSJohn MarinoFor example, against the string 6306af9a77bSJohn Marino.Ql aaa , 6316af9a77bSJohn Marinothe RE 6326af9a77bSJohn Marino.Ql a* 6336af9a77bSJohn Marinowould match the entire string, 6346af9a77bSJohn Marinowhile 6356af9a77bSJohn Marino.Ql a*? 6366af9a77bSJohn Marinowould match the null string at the beginning of the line 6376af9a77bSJohn Marino(matches zero times). 6386af9a77bSJohn MarinoLikewise, against the string 6396af9a77bSJohn Marino.Ql ababab , 6406af9a77bSJohn Marinothe RE 6416af9a77bSJohn Marino.Ql .*b , 6426af9a77bSJohn Marinowould also match the entire string, 6436af9a77bSJohn Marinowhile 6446af9a77bSJohn Marino.Ql .*?b 6456af9a77bSJohn Marinowould only match the first two characters. 6466af9a77bSJohn Marino.Pp 6476af9a77bSJohn MarinoThe 6486af9a77bSJohn Marino.Fn regcomp 6496af9a77bSJohn Marinoflag 6506af9a77bSJohn Marino.Dv REG_UNGREEDY 6516af9a77bSJohn Marinowill make the regular 6526af9a77bSJohn Marino.Pq greedy 6536af9a77bSJohn Marinorepetition operators ungreedy by default. 6546af9a77bSJohn MarinoAppending 6556af9a77bSJohn Marino.Ql \&? 6566af9a77bSJohn Marinomakes them greedy again. 6576af9a77bSJohn Marino.Pp 6586af9a77bSJohn MarinoNote that minimal repetitions are not specified by an official 6596af9a77bSJohn Marinostandard, so there may be differences between different implementations. 6606af9a77bSJohn MarinoIn the current implementation, minimal repetitions have a high precedence, 6616af9a77bSJohn Marinoand can cause other standards requirements to be violated. 6626af9a77bSJohn MarinoFor instance, on the string 6636af9a77bSJohn Marino.Ql aaaaa , 6646af9a77bSJohn Marinothe RE 6656af9a77bSJohn Marino.Ql (aaa??)* 6666af9a77bSJohn Marinowill only match the first four characters, violating the rules that the longest 6676af9a77bSJohn Marinopossible match is made and the longest subexpressions are matched. 6686af9a77bSJohn MarinoUsing 6696af9a77bSJohn Marino.Ql (aaa??)*$ 6706af9a77bSJohn Marinoforces the entire string to be matched. 6716af9a77bSJohn Marino.Ss Non-capturing Parenthesized Subexpressions (available for enhanced extended REs only) 6726af9a77bSJohn MarinoNormally, the match offsets to parenthesized subexpressions are 6736af9a77bSJohn Marinorecorded in the 6746af9a77bSJohn Marino.Fa pmatch 6756af9a77bSJohn Marinoarray (that is, when 6766af9a77bSJohn Marino.Dv REG_NOSUB 6776af9a77bSJohn Marinois not specified, and 6786af9a77bSJohn Marino.Fa nmatch 6796af9a77bSJohn Marinois large enough to encompass the parenthesized subexpression in question). 6806af9a77bSJohn MarinoIn enhanced mode, if the first two characters following the left parenthesis 6816af9a77bSJohn Marinoare 6826af9a77bSJohn Marino.Ql ?: , 6836af9a77bSJohn Marinogrouping of the remaining contents is done, but the corresponding offsets are 6846af9a77bSJohn Marinonot recorded in the 6856af9a77bSJohn Marino.Fa pmatch 6866af9a77bSJohn Marinoarray. 6876af9a77bSJohn MarinoFor example, against the string 6886af9a77bSJohn Marino.Ql fubar , 6896af9a77bSJohn Marinothe RE 6906af9a77bSJohn Marino.Ql (fu)(bar) 6916af9a77bSJohn Marinowould have two subexpression matches in 6926af9a77bSJohn Marino.Fa pmatch ; 6936af9a77bSJohn Marinothe first for 6946af9a77bSJohn Marino.Ql fu 6956af9a77bSJohn Marinoand the second for 6966af9a77bSJohn Marino.Ql bar . 6976af9a77bSJohn MarinoBut with the RE 6986af9a77bSJohn Marino.Ql (?:fu)(bar) , 6996af9a77bSJohn Marinothere would only be one subexpression match, that of 7006af9a77bSJohn Marino.Ql bar . 7016af9a77bSJohn MarinoFurthermore, 7026af9a77bSJohn Marinoagainst the string 7036af9a77bSJohn Marino.Ql fufubar , 7046af9a77bSJohn Marinothe RE 7056af9a77bSJohn Marino.Ql (?fu)*(bar) 7066af9a77bSJohn Marinowould again match the entire string, but only 7076af9a77bSJohn Marino.Ql bar 7086af9a77bSJohn Marinowould be recorded in 7096af9a77bSJohn Marino.Fa pmatch . 7106af9a77bSJohn Marino.Ss Inline Options (available for enhanced extended REs only) 7116af9a77bSJohn MarinoLike the inline literal mode mentioned above, other options can be switched 7126af9a77bSJohn Marinoon and off for part of a RE. 7136af9a77bSJohn Marino.Ql (? Ns Em o.. Ns \&) 7146af9a77bSJohn Marinowill turn on the options specified in 7156af9a77bSJohn Marino.Em o.. 7166af9a77bSJohn Marino(one or more options characters; see below), while 7176af9a77bSJohn Marino.Ql (?- Ns Em o.. Ns \&) 7186af9a77bSJohn Marinowill turn off the specified options, and 7196af9a77bSJohn Marino.Ql (? Ns Em o1.. Ns \&- Ns Em o2.. Ns \&) 7206af9a77bSJohn Marinowill turn on the first set of options, and turn off the second set. 7216af9a77bSJohn Marino.Pp 7226af9a77bSJohn MarinoThe available options are: 7236af9a77bSJohn Marino.Bl -tag -width ".Sy \&U" -offset indent 7246af9a77bSJohn Marino.It Sy \&i 7256af9a77bSJohn MarinoTurning on this option will ignore case during matching, while turning off 7266af9a77bSJohn Marinowill restore case-sensitive matching. 7276af9a77bSJohn MarinoIf 7286af9a77bSJohn Marino.Dv REG_ICASE 7296af9a77bSJohn Marinowas specified to 7306af9a77bSJohn Marino.Fn regcomp , 731dda92f98SSascha Wildnerthis option can be used to turn that off. 7326af9a77bSJohn Marino.It Sy \&n 7336af9a77bSJohn MarinoTurn on or off special handling of the newline character. 7346af9a77bSJohn MarinoIf 7356af9a77bSJohn Marino.Dv REG_NEWLINE 7366af9a77bSJohn Marinowas specified to 7376af9a77bSJohn Marino.Fn regcomp , 738dda92f98SSascha Wildnerthis option can be used to turn that off. 7396af9a77bSJohn Marino.It Sy \&U 7406af9a77bSJohn MarinoTurning on this option will make ungreedy repetitions the default, while 7416af9a77bSJohn Marinoturning off will make greedy repetitions the default. 7426af9a77bSJohn MarinoIf 7436af9a77bSJohn Marino.Dv REG_UNGREEDY 7446af9a77bSJohn Marinowas specified to 7456af9a77bSJohn Marino.Fn regcomp , 746dda92f98SSascha Wildnerthis option can be used to turn that off. 7476af9a77bSJohn Marino.El 7486af9a77bSJohn Marino.Pp 7496af9a77bSJohn MarinoThe scope of the option change begins immediately following the right 7506af9a77bSJohn Marinoparenthesis, 7516af9a77bSJohn Marinobut up to the end of the enclosing subexpression (if any). 7526af9a77bSJohn MarinoThus, for example, given the RE 7536af9a77bSJohn Marino.Ql (fu(?i)bar)baz , 7546af9a77bSJohn Marinothe 7556af9a77bSJohn Marino.Ql fu 7566af9a77bSJohn Marinoportion matches case sensitively, 7576af9a77bSJohn Marino.Ql bar 7586af9a77bSJohn Marinomatches case insensitively, and 7596af9a77bSJohn Marino.Ql baz 7606af9a77bSJohn Marinomatches case sensitively again (since is it outside the scope of the 7616af9a77bSJohn Marinosubexpression in which the inline option was specified). 7626af9a77bSJohn Marino.Pp 7636af9a77bSJohn MarinoThe inline options syntax can be combined with the non-capturing parenthesized 7646af9a77bSJohn Marinosubexpression to limit the option scope to just that of the subexpression. 7656af9a77bSJohn MarinoThen, for example, 7666af9a77bSJohn Marino.Ql fu(?i:bar)baz 7676af9a77bSJohn Marinois similar to the previous example, except for the parenthesize subexpression 7686af9a77bSJohn Marinoaround 7696af9a77bSJohn Marino.Ql fu(?i)bar 7706af9a77bSJohn Marinoin the previous example. 7716af9a77bSJohn Marino.Ss Inline Comments (available for enhanced extended REs only) 7726af9a77bSJohn MarinoThe syntax 7736af9a77bSJohn Marino.Ql (?# Ns Em comment Ns \&) 7746af9a77bSJohn Marinocan be used to embed comments within a RE. 7756af9a77bSJohn MarinoNote that 7766af9a77bSJohn Marino.Em comment 7776af9a77bSJohn Marinocan not contain a right parenthesis. 7786af9a77bSJohn MarinoAlso note that while syntactically, option characters can be added before 7796af9a77bSJohn Marinothe 7806af9a77bSJohn Marino.Ql \&# 7816af9a77bSJohn Marinocharacter, they will be ignored. 7826af9a77bSJohn Marino.Sh SEE ALSO 7836af9a77bSJohn Marino.Xr regex 3 7846af9a77bSJohn Marino.Rs 7856af9a77bSJohn Marino.%T Regular Expression Notation 7866af9a77bSJohn Marino.%R IEEE Std 7876af9a77bSJohn Marino.%N 1003.2 7886af9a77bSJohn Marino.%P section 2.8 7896af9a77bSJohn Marino.Re 7906af9a77bSJohn Marino.Sh BUGS 7916af9a77bSJohn MarinoHaving two kinds of REs is a botch. 7926af9a77bSJohn Marino.Pp 7936af9a77bSJohn MarinoThe current 7946af9a77bSJohn Marino.St -p1003.2 7956af9a77bSJohn Marinospec says that 7966af9a77bSJohn Marino.Ql \&) 7976af9a77bSJohn Marinois an ordinary character in 7986af9a77bSJohn Marinothe absence of an unmatched 7996af9a77bSJohn Marino.Ql \&( ; 8006af9a77bSJohn Marinothis was an unintentional result of a wording error, 8016af9a77bSJohn Marinoand change is likely. 8026af9a77bSJohn MarinoAvoid relying on it. 8036af9a77bSJohn Marino.Pp 8046af9a77bSJohn MarinoBack references are a dreadful botch, 8056af9a77bSJohn Marinoposing major problems for efficient implementations. 8066af9a77bSJohn MarinoThey are also somewhat vaguely defined 8076af9a77bSJohn Marino(does 8086af9a77bSJohn Marino.Ql a\e(\e(b\e)*\e2\e)*d 8096af9a77bSJohn Marinomatch 8106af9a77bSJohn Marino.Ql abbbd ? ) . 8116af9a77bSJohn MarinoAvoid using them. 8126af9a77bSJohn Marino.Pp 8136af9a77bSJohn Marino.St -p1003.2 8146af9a77bSJohn Marinospecification of case-independent matching is vague. 8156af9a77bSJohn MarinoThe 8166af9a77bSJohn Marino.Dq one case implies all cases 8176af9a77bSJohn Marinodefinition given above 8186af9a77bSJohn Marinois current consensus among implementors as to the right interpretation. 8196af9a77bSJohn Marino.Pp 8206af9a77bSJohn MarinoThe bracket syntax for word boundaries is incredibly ugly. 821