Re: [SQL] question about reg. expression

2011-01-22 Thread Jasen Betts
On 2011-01-18, andrew1 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 thi

Re: [SQL] question about reg. expression

2011-01-19 Thread Kenneth Marshall
On Wed, Jan 19, 2011 at 08:17:50AM -0500, Stephen Belcher wrote: > Another way to match multiple occurrences is to use curly brackets with a > number, like: > select 'ab' ~ '^[a-z]{2}$'; > > It can be done with a range of numbers as well: > select 'ab' ~ '^[a-z]{2,4}$'; > select 'abab' ~ '^[a-z]{2

Re: [SQL] question about reg. expression

2011-01-19 Thread Stephen Belcher
Another way to match multiple occurrences is to use curly brackets with a number, like: select 'ab' ~ '^[a-z]{2}$'; It can be done with a range of numbers as well: select 'ab' ~ '^[a-z]{2,4}$'; select 'abab' ~ '^[a-z]{2,4}$'; I believe, however, that the curly brackets notation was introduced in

Re: [SQL] question about reg. expression

2011-01-19 Thread Samuel Gendler
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: sel

[SQL] question about reg. expression

2011-01-18 Thread andrew1
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