Re: [GENERAL] Regex problems - Mailing list pgsql-general

From James Oden
Subject Re: [GENERAL] Regex problems
Date
Msg-id 005401bdf1e5$3d5f4320$01cc0cac@Yehudah.lee.k12.nc.us
Whole thread Raw
In response to [GENERAL] Regex problems  (Charles Curley <charles.h.curley@lmco.com>)
List 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 by date:

Previous
From: aharon@deltathree.com (Aharon (Al) Schkolnik)
Date:
Subject: Up-to-date PostgreSQL User's Guide - Postscipt ?
Next
From: Sferacarta Software
Date:
Subject: Re: [GENERAL] Default 'timestamp' value on HP-UX running Postgresql6.3.2