Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RRQ-0005AC-5Y for pgsql-docs@arkaria.postgresql.org; Sat, 01 Feb 2014 03:40:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9RRP-0004X9-Km for pgsql-docs@arkaria.postgresql.org; Sat, 01 Feb 2014 03:40:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RRO-0004Wu-O1 for pgsql-docs@postgresql.org; Sat, 01 Feb 2014 03:40:22 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9RRL-0005xY-9k for pgsql-docs@postgresql.org; Sat, 01 Feb 2014 03:40:22 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1W9RRK-00048J-Hv; Fri, 31 Jan 2014 22:40:18 -0500 Date: Fri, 31 Jan 2014 22:40:18 -0500 From: Bruce Momjian To: Tom Lane Cc: PostgreSQL-documentation Subject: Re: regexp_replace 'g' flag Message-ID: <20140201034018.GF31141@momjian.us> References: <20130906003744.GF27195@momjian.us> <20130906005102.GG27195@momjian.us> <5459.1378432753@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MfFXiAuoTsnnDAfZ" Content-Disposition: inline In-Reply-To: <5459.1378432753@sss.pgh.pa.us> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --MfFXiAuoTsnnDAfZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 5, 2013 at 09:59:13PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > On Thu, Sep 5, 2013 at 08:37:44PM -0400, Bruce Momjian wrote: > >> Why doesn't the 'g' flag appear in this table? > >> http://www.postgresql.org/docs/9.2/static/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE > > > Is it because the table has generic pattern modififers and 'g' only is > > relevant for regexp_replace? I assume so. > > The table is specifically about ARE options, and 'g' is *not* one of > those. Adding 'g' to the table would be wrong. > > It does seem to me to be a bit confusing that the text description of > substring() mentions 'i' and 'g' explicitly, when only 'i' is listed in > the table. You could make a case for phrasing along the line of > "substring() supports the 'g' flag that specifies ..., as well as all the > flags listed in Table 9-19". On the other hand, 'i' is the most useful of > the flags listed in the table by several country miles, and it doesn't > seem quite right to make people go off and consult the table to find out > about it. > > Not sure whether there's any real improvement that can be made here, > but I suppose it'd be nice if the text descriptions of substring() and > regexp_replace() handled this matter in the same way ... I went ahead and just explicitly documented that 'g' is not in the table. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --MfFXiAuoTsnnDAfZ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="regex.diff" diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 9c2708c..252539f 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -3984,7 +3984,8 @@ substring('foobar' from 'o(.)b') o string containing zero or more single-letter flags that change the function's behavior. Flag i specifies case-insensitive matching, while flag g specifies replacement of each matching - substring rather than only the first one. Other supported flags are + substring rather than only the first one. Supported flags (though + not g) are described in . @@ -4021,8 +4022,9 @@ regexp_replace('foobarbaz', 'b(..)', E'X\\1Y', 'g') string containing zero or more single-letter flags that change the function's behavior. Flag g causes the function to find each match in the string, not only the first one, and return a row for - each such match. Other supported - flags are described in . + each such match. Supported flags (though + not g) + are described in . --MfFXiAuoTsnnDAfZ Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --MfFXiAuoTsnnDAfZ--