[GENERAL] Regex problems

Поиск
Список
Период
Сортировка
От Charles Curley
Тема [GENERAL] Regex problems
Дата
Msg-id 361A6AD0.67E70985@lmco.com
обсуждение исходный текст
Ответы Re: [GENERAL] Regex problems  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-general
I'm running 6.3.2 on RedHat 5.0. I have the following table:

Table    = employees
+---------------------+----------------------------------+-------+
|    Field            |              Type                | Length|
+---------------------+----------------------------------+-------+
| id                  | char() not null                  |     8 |
| first               | char()                           |    20 |
| mi                  | char()                           |     1 |
| last                | char()                           |    20 |
| suffix              | char()                           |     8 |
| dept                | char()                           |     8 |
| phone               | char()                           |    20 |
| mp                  | char()                           |     8 |
| email               | char()                           |    64 |
+---------------------+----------------------------------+-------+

If I do the following:

select "dept", "last", "first" from "employees" where "last" = 'Curley';

I get my information. If I do:

select "dept", "last", "first" from "employees" where "last" ~ 'C*';

I get the entire table's worth of matches (883) regardless of what the last name is. Examples that are matched:

dept    |last                |first
--------+--------------------+-------
A5A0    |Achey               |Karen
A5M2    |Achey               |Lonny
A75P    |Ackley              |Roger
A847    |Adair               |Ethel
A84P    |Adams               |Denise
A654    |Adams               |Gary
...
A847    |Young               |Ronald
A75P    |Younger             |Curtis
A847    |Zappia              |Sandy
A850    |Zrinski             |Beverly
A5MP    |Zygmant             |Michael
(883 rows)

Trying the following:

select "dept", "last", "first" from "employees" where "last" ~ 'Cu*';

Produces fewer hits (74) but gives wrong values again, basically returning all the employees with a last name that begins with 'C' as well a few strange matches at the end with "last" values of 'Del Castillo', 'Moore', and 'O''Connor'.

Telling me to use LIKE isn't what I'm hoping to get here. My searches will require that I use regular expressions, I just toned them down for the examples.

--
Charles Curley, Staff Engineer
Computer Integrated Manufacturing
Lockheed Martin Ocala Operations
 

В списке pgsql-general по дате отправления:

Предыдущее
От: Andrea Antibo
Дата:
Сообщение: Re: [GENERAL] make[2]: *** [psql] Error 1
Следующее
От: "chris yambo"
Дата:
Сообщение: Re: [GENERAL] Regex problems