Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-20 Thread Rui Martins
Hi Tom > "Rui Martins" <[EMAIL PROTECTED]> writes: >> My reasoning is: >> Why would the exact same sub-expression, return different results when >> either preceded or followed by something. > > It *isn't* returning different results; you are testing for different > things in these two cases, namel

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-20 Thread Tom Lane
"Rui Martins" <[EMAIL PROTECTED]> writes: > But the sub-expression did "match" ! No, the sub-expression "(something)" did not match. What did match is the larger expression "(something)?". You seem to be failing to recognize that these are two different things. If you put the capturing parenthe

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-20 Thread Tom Lane
"Rui Martins" <[EMAIL PROTECTED]> writes: > My reasoning is: > Why would the exact same sub-expression, return different results when > either preceded or followed by something. It *isn't* returning different results; you are testing for different things in these two cases, namely whether there is

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-20 Thread Rui Martins
> "Rui Martins" <[EMAIL PROTECTED]> writes: >> Even though this can me though as argumentative, think about this >> expression: > >> (something)? > >> Will "match" with an empty string in the context of a full expression, >> and >> will return an EMPTY String. So by analogy, I would expect it, to r

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-19 Thread Tom Lane
"Rui Martins" <[EMAIL PROTECTED]> writes: > Even though this can me though as argumentative, think about this expression: > (something)? > Will "match" with an empty string in the context of a full expression, and > will return an EMPTY String. So by analogy, I would expect it, to return > the sa

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-19 Thread Rui Martins
Hi Tom What I meant is: SELECT '' ~ '^(something)?$' This will match, i.e. the empty string will match with the expression, and substring would return and empty string. or in other words: it returns true SELECT SUBSTRING( '', '^(something)?$' ) This will also match, has a global expres

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-19 Thread Rui Martins
Hi Tom Just a side note, See comments below. > "Rui Martins" <[EMAIL PROTECTED]> writes: >> Description:Incorrect RegExp substring Output > >>SUBSTRING( BedNo FROM '^[[:digit:]]+[a-zA-Z]*(:[[:digit:]]+)?$' ) > > Interesting. It had never occurred to me that it's possible for the

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-19 Thread Tom Lane
"Rui Martins" <[EMAIL PROTECTED]> writes: > Here the context of the word "match" may be misleading us, in this > conversation. > I say this, because in my report, the second substring expression, the one > for RoomSize: > SUBSTRING( BedNo, '^[[:digit:]]+([a-zA-Z]*)(:[[:digit:]]+)?$' ) AS RoomSize,

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-19 Thread Rui Martins
> "Rui Martins" <[EMAIL PROTECTED]> writes: >> Description:Incorrect RegExp substring Output > >>SUBSTRING( BedNo FROM '^[[:digit:]]+[a-zA-Z]*(:[[:digit:]]+)?$' ) > > Interesting. It had never occurred to me that it's possible for the > whole pattern to have a match when some pare

Re: [BUGS] BUG #4044: Incorrect RegExp substring Output

2008-03-18 Thread Tom Lane
"Rui Martins" <[EMAIL PROTECTED]> writes: > Description:Incorrect RegExp substring Output >SUBSTRING( BedNo FROM '^[[:digit:]]+[a-zA-Z]*(:[[:digit:]]+)?$' ) Interesting. It had never occurred to me that it's possible for the whole pattern to have a match when some parenthesized