| From: | Harald Fuchs <hf0923x(at)protecting(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Question on the use of bracket expressions in Postgres |
| Date: | 2005-12-15 10:16:42 |
| Message-ID: | 87u0da4qd1.fsf@srv.protecting.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
In article <F96F2B16-2A2A-4A28-97E1-1B00C9902808(at)myrealbox(dot)com>,
Michael Glaesemann <grzm(at)myrealbox(dot)com> writes:
> On Dec 15, 2005, at 0:29 , Jimmy Rowe wrote:
>> select * from catalog where file_name like 'abc%def%.200[2-5]%';
>> The following select keeps returning "(0 rows)".
> LIKE doesn't consider [2-5] to be a range, but rather the literal
> characters '[2-5]'. If you're looking for regex, take a look at the
> POSIX regex operator ~
> http://www.postgresql.org/docs/current/interactive/functions-
> matching.html#FUNCTIONS-POSIX-REGEXP
> See if something like file_name ~ 'abc.*def.*\.200[2-5]'
That's not quite the same because LIKE matching is anchored.
Try something like file_name ~ '^abc.*def.*\.200[2-5]$'
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pandurangan R S | 2005-12-15 11:07:48 | Re: copying a database without dumping it |
| Previous Message | Marc Brünink | 2005-12-15 10:08:45 | copying a database without dumping it |