Re: question about reg. expression - Mailing list pgsql-sql

From Jasen Betts
Subject Re: question about reg. expression
Date
Msg-id ihe69f$hl3$2@reversiblemaps.ath.cx
Whole thread Raw
In response to question about reg. expression  (andrew1 <andrew1@mytrashmail.com>)
List pgsql-sql
On 2011-01-18, andrew1 <andrew1@mytrashmail.com> wrote:
> hi all,
>
> these return t:
> select 'ab' ~ '[a-z]$'

this matches the b and the end of the string

> select 'ab' ~ '^[a-z]'

this matches the start of the string and the a

> select 'ab' ~ '^[a-z]$' returns f

> Can't I use ^ and $ at the same time to match, in this case?
> thanks.

the above expression only succeeds if the string is one character long

use '+' '*' or '{2}' etc after the '[a-z]' to allow it to match several letters

or use '^[a-z]|[a-z]$' to match any sting that starts or ends with a
letter.

what are you trying to find?




-- 
⚂⚃ 100% natural


pgsql-sql by date:

Previous
From: MoNiLlO
Date:
Subject: Control reached end of trigger procedure without RETURN
Next
From: Adelo Herrero Pérez
Date:
Subject: Control reached end of trigger procedure without RETURN