| From: | Magnus Hagander <magnus(at)hagander(dot)net> |
|---|---|
| To: | Mikhail <Tuchkov(dot)Michail(at)gmail(dot)com> |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #3487: regular exp |
| Date: | 2007-07-26 07:53:09 |
| Message-ID: | 20070726075309.GA22213@svr2.hagander.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Thu, Jul 26, 2007 at 05:53:54AM +0000, Mikhail wrote:
>
> The following bug has been logged online:
>
> Bug reference: 3487
> Logged by: Mikhail
> Email address: Tuchkov(dot)Michail(at)gmail(dot)com
> PostgreSQL version: 8.1
> Operating system: windows 2003 SP2
> Description: regular exp
> Details:
>
> Please, help me!
> My code:
> "IF char_length(substring(str from '^[a-zA-Z]*://'))=0 THEN
> str:= 'http://'||str;
> END IF;"
>
> If str= http://www.msn.com then nothing happen
> (all is OK), but if str= just www.msn.com then nothing happen too!
>
> Why?
Because substring() returns NULL when there is no match, not the empty
string. So you need
IF substring(str from '^[a-zA-Z]*://') IS NULL THEN
...
//Magnus
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephan Szabo | 2007-07-26 15:08:51 | Re: bug with RE |
| Previous Message | sreenair | 2007-07-26 06:01:23 | BUG #3488: exporting data |