| From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: question about reg. expression |
| Date: | 2011-01-22 08:59:27 |
| Message-ID: | ihe69f$hl3$2@reversiblemaps.ath.cx |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On 2011-01-18, andrew1 <andrew1(at)mytrashmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adelo Herrero Pérez | 2011-01-22 09:37:01 | Control reached end of trigger procedure without RETURN |
| Previous Message | Jasen Betts | 2011-01-22 08:53:40 | Re: Issue with postgres connectivity |