Re: FInding "corrupt" values in UTF-8 tables (regexp question, I think)

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: FInding "corrupt" values in UTF-8 tables (regexp question, I think)
Date: 2007-08-17 16:19:29
Message-ID: 2DA6174E-A765-46BB-8AF4-30DDF2474CB3@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Aug 17, 2007, at 10:58 , Phoenix Kiula wrote:

> What would be the SQL to find data of this nature? My column can only
> have alphanumeric data, and the only symbols allowed are "-" and "_",
> so I tried this regexp query:
>
> select id, t_code
> from traders
> where t_code ~ '[^A-Za-z1-9\-]'

If you're including - in a range as a character, doesn't it have to
go first?
Try this:

WHERE t_code ~ $re$[^-A-Za-z1-9_]$re$

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2007-08-17 16:48:58 Re: Help creating a function
Previous Message Manuel Sugawara 2007-08-17 16:09:09 Re: FInding "corrupt" values in UTF-8 tables (regexp question, I think)