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

From Samuel Gendler
Subject Re: question about reg. expression
Date
Msg-id AANLkTi=guS5T46M5wt7VXH8_0SfZ-_D+uG6Y=68FAFWJ@mail.gmail.com
Whole thread Raw
In response to question about reg. expression  (andrew1 <andrew1@mytrashmail.com>)
Responses Re: question about reg. expression
List pgsql-sql
I'd think you need to indicate multiple alphabetic matches.  Your first regex actually matches only b followed by end of string and the second is really only matching start of string followed by a.  The third is looking for a single character string.

Try this: select 'ab' ~ '^[a-z]+$'
or this: select 'ab' ~ '^[a-z]*$'

or if looking only for 2 character strings: select 'ab' ~ '^[a-z][a-z]$'

On Tue, Jan 18, 2011 at 3:41 PM, andrew1 <andrew1@mytrashmail.com> wrote:
hi all,

these return t:
select 'ab' ~ '[a-z]$'
select 'ab' ~ '^[a-z]'

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

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

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

pgsql-sql by date:

Previous
From: andrew1
Date:
Subject: question about reg. expression
Next
From: Stephen Belcher
Date:
Subject: Re: question about reg. expression