pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: question about reg. expression
Date: 22 Jan 2011 08:59:27 GMT
Message-ID: <ihe69f$hl3$2@reversiblemaps.ath.cx> (raw)
References: <ih58f7$63u$1@speranza.aioe.org>

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



view thread (5+ messages)

Message-ID: <ihe69f$hl3$2@reversiblemaps.ath.cx>
Permalink:  ../ihe69f$hl3$2@reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/ihe69f$hl3$2@reversiblemaps.ath.cx

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasen@xnet.co.nz
  Subject: Re: question about reg. expression
  In-Reply-To: <ihe69f$hl3$2@reversiblemaps.ath.cx>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox