Re: Quick Regex Question

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Quick Regex Question
Date: 2007-12-20 10:25:43
Message-ID: 20071220112543.4d462203@webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 20 Dec 2007 09:56:00 +0000
Howard Cole <howardnews(at)selestial(dot)com> wrote:

> Hi all,
>
> I don't understand the last result:
>
> select 'Ho Ho Ho' ~* '^Ho'; returns true

There is actualli a Ho at the beginning of the string.

> select 'Ho Ho Ho' ~* ' Ho'; returns true

There are actually 2 ' Ho'

> select 'Ho Ho Ho' ~* '[^ ]Ho'; returns false (Please note there is
> a space between ^ and ])

There is no some character excluding space plus Ho.
What's missing is you're asking for some character before Ho.
The first Ho doesn't have a character preceding it.
The 2 other Ho have one... but it is a space and you don't want it.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Howard Cole 2007-12-20 10:25:50 Re: Quick Regex Question
Previous Message Richard Huxton 2007-12-20 10:11:01 Re: Quick Regex Question