Re: Quick Regex Question - Mailing list pgsql-general

From Richard Huxton
Subject Re: Quick Regex Question
Date
Msg-id 476A3FB5.5040608@archonet.com
Whole thread Raw
In response to Quick Regex Question  (Howard Cole <howardnews@selestial.com>)
Responses Re: Quick Regex Question
List pgsql-general
Howard Cole wrote:
> Hi all,
>
> I don't understand the last result:
>
> select 'Ho Ho Ho' ~* '^Ho'; returns true
> select 'Ho Ho Ho' ~* ' Ho'; returns true
> select 'Ho Ho Ho' ~* '[^ ]Ho'; returns false (Please note there is a
> space between ^ and ])
>
>  From my limited experience of regex, the last one is searching for either
>    'Ho' preceeeded by space or
>    'Ho' at the beginning of a string.

No, it's searching for not-space, the ^ inverts the meaning of the
square brackets. You probably want something like '(^Ho)|( Ho)'

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Florian Aumeier
Date:
Subject: Re: Quick Regex Question
Next
From: Marco Aurélio V. da Silva
Date:
Subject: Re: Problem with collector statistic