Thread: Double Backslash example patch
Kind people, Please find enclosed a patch exemplifying typical use of the ARE Class-Shorthand Escapes®. I believe it will help intrepid regex users. :) Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 cell: +1 415 235 3778
Attachment
David Fetter wrote: > Please find enclosed a patch exemplifying typical use of the ARE > Class-Shorthand Escapes®. I believe it will help intrepid regex > users. :) If you want to explain something, it's normally better to create an example just for that point, instead of piggybacking it onto another example. Else you just make it harder for people to recognize the relevant information. For instance, in the case you want to patch the example aims to show how patterns are not anchored, as opposed to the pattern for the LIKE operator. What does the escape syntax of the pattern have to do with that?
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches I will try to apply it within the next 48 hours. --------------------------------------------------------------------------- David Fetter wrote: > Kind people, > > Please find enclosed a patch exemplifying typical use of the ARE > Class-Shorthand Escapes®. I believe it will help intrepid regex > users. :) > > Cheers, > D > -- > David Fetter david@fetter.org http://fetter.org/ > phone: +1 510 893 6100 cell: +1 415 235 3778 [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Peter Eisentraut wrote: > David Fetter wrote: > > Please find enclosed a patch exemplifying typical use of the ARE > > Class-Shorthand Escapes??. I believe it will help intrepid regex > > users. :) > > If you want to explain something, it's normally better to create an > example just for that point, instead of piggybacking it onto another > example. Else you just make it harder for people to recognize the > relevant information. > > For instance, in the case you want to patch the example aims to show how > patterns are not anchored, as opposed to the pattern for the LIKE > operator. What does the escape syntax of the pattern have to do with > that? He is reminding folks about double-backslashes in a relivant place --- makes sense to me. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian writes: > > Your patch has been added to the PostgreSQL unapplied patches list at: > > http://momjian.postgresql.org/cgi-bin/pgpatches > > I will try to apply it within the next 48 hours. Please don't. Add a new example if you want, but don't overload existing examples with unrelated information. > > --------------------------------------------------------------------------- > > > David Fetter wrote: >> Kind people, >> >> Please find enclosed a patch exemplifying typical use of the ARE >> Class-Shorthand Escapes®. I believe it will help intrepid regex >> users. :) >> >> Cheers, >> D >> -- >> David Fetter david@fetter.org http://fetter.org/ >> phone: +1 510 893 6100 cell: +1 415 235 3778 > > [ Attachment, skipping... ] > >> >> ---------------------------(end of >> broadcast)--------------------------- TIP 4: Don't 'kill -9' the >> postmaster > > -- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 359-1001 > + If your life is a hard drive, | 13 Roberts Road > + Christ can be your backup. | Newtown Square, Pennsylvania > 19073
Bruce Momjian wrote: > He is reminding folks about double-backslashes in a relivant place > --- makes sense to me. The relevant place would be far below where it already says: Note: Keep in mind that an escape's leading \ will need to be doubled when entering the pattern as an SQL string constant. So it's already covered.
On Tue, Dec 16, 2003 at 04:32:37PM +0100, Peter Eisentraut wrote: > Bruce Momjian wrote: > > He is reminding folks about double-backslashes in a relivant place > > --- makes sense to me. > > The relevant place would be far below where it already says: > > Note: Keep in mind that an escape's leading \ will need to be > doubled when entering the pattern as an SQL string constant. > > So it's already covered. With all due respect, Peter, it is only implicit in the docs, and that is not always good enough. An explicit example will help, as PostgreSQL's quoting system would qualify for an early place on the 'gotchas' page (cf. http://sql-info.de/mysql/gotchas.html) if PostgreSQL had one. Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 cell: +1 415 235 3778
David Fetter wrote: > With all due respect, Peter, it is only implicit in the docs, and > that is not always good enough. An explicit example will help, as Sure, I'm just pointing out the most appropriate place to put it.
I have applied your additional example in the place Peter suggested. Patch attached. --------------------------------------------------------------------------- David Fetter wrote: > Kind people, > > Please find enclosed a patch exemplifying typical use of the ARE > Class-Shorthand Escapes®. I believe it will help intrepid regex > users. :) > > Cheers, > D > -- > David Fetter david@fetter.org http://fetter.org/ > phone: +1 510 893 6100 cell: +1 415 235 3778 [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: doc/src/sgml/func.sgml =================================================================== RCS file: /cvsroot/pgsql-server/doc/src/sgml/func.sgml,v retrieving revision 1.182 diff -c -c -r1.182 func.sgml *** doc/src/sgml/func.sgml 16 Dec 2003 15:27:58 -0000 1.182 --- doc/src/sgml/func.sgml 18 Dec 2003 03:53:59 -0000 *************** *** 3134,3140 **** <note> <para> Keep in mind that an escape's leading <literal>\</> will need to be ! doubled when entering the pattern as an SQL string constant. </para> </note> --- 3134,3143 ---- <note> <para> Keep in mind that an escape's leading <literal>\</> will need to be ! doubled when entering the pattern as an SQL string constant. For example: ! <programlisting> ! '123' ~ '^\\d{3}' <lineannotation>true</lineannotation> ! </programlisting> </para> </note>