Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread Rob Marjot
True, but still weird... And are you sure it does the same thing? 2011/12/13 Szymon Guz > > > On 13 December 2011 14:04, InterRob wrote: > >> Dear List, >> >> I found this interesting: >> >> SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); >> ERROR: invalid regular expression: invalid charact

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread Merlin Moncure
On Tue, Dec 13, 2011 at 10:53 AM, David Johnston wrote: > Aside from backward compatibility, and the various warnings, is there any > reason to prefer dollar-quoting over a non-SQL-escaped string literal (i.e., > '3[A-Z\-\(\) ]'   ) ? yeah -- because sooner or later you have to stick a single quo

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Merlin Moncure Sent: Tuesday, December 13, 2011 11:39 AM To: r...@marjot-multisoft.com Cc: David Johnston; Szymon Guz; pgsql-general Subject: Re: [GENERAL] order of (escaped

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread Merlin Moncure
On Tue, Dec 13, 2011 at 7:51 AM, InterRob wrote: > Thanks guys, i see what you mean. > > I do intend to use the PG escaping, in order to avoid that annoying > warning... Hence, my expression should indeed be: > SELECT regexp_matches('123-A' , E'(3[A-Z\\-\\(\\) ])'); > > In the above expression i a

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread hubert depesz lubaczewski
On Tue, Dec 13, 2011 at 02:51:15PM +0100, InterRob wrote: > Thanks guys, i see what you mean. > > I do intend to use the PG escaping, in order to avoid that annoying > warning... Hence, my expression should indeed be: > SELECT regexp_matches('123-A' , E'(3[A-Z\\-\\(\\) ])'); > > In the above expr

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread InterRob
Thanks guys, i see what you mean. I do intend to use the PG escaping, in order to avoid that annoying warning... Hence, my expression should indeed be: SELECT regexp_matches('123-A' , E'(3[A-Z\\-\\(\\) ])'); In the above expression i added the parentheses as I whish to match these as well :)) Th

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread David Johnston
On Dec 13, 2011, at 8:09, Szymon Guz wrote: > > > On 13 December 2011 14:04, InterRob wrote: > Dear List, > > I found this interesting: > > SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); > ERROR: invalid regular expression: invalid character range > > whereas: > SELECT regexp_matches('12

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread InterRob
True, but still weird... And are you sure it does the same thing? 2011/12/13 Szymon Guz > > > On 13 December 2011 14:04, InterRob wrote: > >> Dear List, >> >> I found this interesting: >> >> SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); >> ERROR: invalid regular expression: invalid charact

Re: [GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread Szymon Guz
On 13 December 2011 14:04, InterRob wrote: > Dear List, > > I found this interesting: > > SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); > ERROR: invalid regular expression: invalid character range > > whereas: > SELECT regexp_matches('123-A' , E'(3[\- A-Z])'); > regexp_matches >

[GENERAL] order of (escaped) characters in regex range

2011-12-13 Thread InterRob
Dear List, I found this interesting: SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); ERROR: invalid regular expression: invalid character range whereas: SELECT regexp_matches('123-A' , E'(3[\- A-Z])'); regexp_matches {3-} (1 row) Notice the order of (escaped) characters and