[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

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

2011-12-13 Thread Szymon Guz
On 13 December 2011 14:04, InterRob rob.mar...@gmail.com 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

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 mabew...@gmail.com On 13 December 2011 14:04, InterRob rob.mar...@gmail.com wrote: Dear List, I found this interesting: SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); ERROR: invalid regular

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

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

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 :))

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 expression

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 rob.mar...@gmail.com 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

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 10:53 AM, David Johnston pol...@yahoo.com 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

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 mabew...@gmail.com On 13 December 2011 14:04, InterRob rob.mar...@gmail.com wrote: Dear List, I found this interesting: SELECT regexp_matches('123-A' , E'(3[A-Z\- ])'); ERROR: invalid regular