Re: [GENERAL] Regex problems

Поиск
Список
Период
Сортировка
От James Oden
Тема Re: [GENERAL] Regex problems
Дата
Msg-id 005401bdf1e5$3d5f4320$01cc0cac@Yehudah.lee.k12.nc.us
обсуждение исходный текст
Ответ на [GENERAL] Regex problems  (Charles Curley <charles.h.curley@lmco.com>)
Список pgsql-general

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:

The answer is you need to use the meta character that tells the regx engine to look at only the begining of the string for a match.  That is your regular expression should be:

     "^C"

or

   "^C*"

which yields a query like:

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

Adding the 'u' is not a bad idea if you want to get only the last names that start with "Cu".

...james

 

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

Предыдущее
От: aharon@deltathree.com (Aharon (Al) Schkolnik)
Дата:
Сообщение: Up-to-date PostgreSQL User's Guide - Postscipt ?
Следующее
От: Sferacarta Software
Дата:
Сообщение: Re: [GENERAL] Default 'timestamp' value on HP-UX running Postgresql6.3.2