[GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi


Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a 
column with First names and need to list names that have non-alphanumeric 
characters in them like + or * and the list goes on.  I did google a bit and 
tried:
select * from TABLE where first_name not like '%[a-z0-9]%';

However the above shows all the entries in that column and if I change it to 
Like, which should show all the entries it shows nothing.

e.g of my goal:

Column
Bob
Jane+
Harry*
John
Mike
Larry

My query should output

Jane+
Harry*



To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread John R Pierce

On 4/11/2013 11:23 PM, Baboo, Isa wrote:


Firstly let me mention I am a noob to postgres,DB and sql anyway, I 
have a column with First names and need to list names that have 
non-alphanumeric characters in them like + or * and the list goes on.  
I did google a bit and tried:


/select * from TABLE where first_name not like '%[a-z0-9]%'; /



you'll probably have to use a regex for that.

something like...  (my regex is really rusty)

   ... WHERE first_name !~ '^[a-z0-9]*$';



--
john r pierce  37N 122W
somewhere on the middle of the left coast



Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

Thanks for the response but I tried that and it does not work here is an 
example of names which still display.

test
sadadds
Hillary
BEN NAME
ALAN MCGARVEY +


From: pgsql-general-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
Sent: 12 April 2013 08:41 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

On 4/11/2013 11:23 PM, Baboo, Isa wrote:
Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a 
column with First names and need to list names that have non-alphanumeric 
characters in them like + or * and the list goes on.  I did google a bit and 
tried:
select * from TABLE where first_name not like '%[a-z0-9]%';

you'll probably have to use a regex for that.

something like...  (my regex is really rusty)

   ... WHERE first_name !~ '^[a-z0-9]*$';





--

john r pierce  37N 122W

somewhere on the middle of the left coast

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Ian Lawrence Barwick
 From: pgsql-general-ow...@postgresql.org
 [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
 Sent: 12 April 2013 08:41 AM
 To: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] list non alphanumeric



 On 4/11/2013 11:23 PM, Baboo, Isa wrote:

 Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a
 column with First names and need to list names that have non-alphanumeric
 characters in them like + or * and the list goes on.  I did google a bit and
 tried:

 select * from TABLE where first_name not like '%[a-z0-9]%';


 you'll probably have to use a regex for that.

 something like...  (my regex is really rusty)

... WHERE first_name !~ '^[a-z0-9]*$';

2013/4/12 Baboo, Isa iba...@fnb.co.za:

 Hi

 Thanks for the response but I tried that and it does not work here is an
 example of names which still display.

 test
 sadadds
 Hillary
 BEN NAME
 ALAN MCGARVEY +

Something like:

... WHERE first_name ~ '[^\w]'

might do the trick.

Regards

Ian Barwick


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread John R Pierce

On 4/11/2013 11:50 PM, Baboo, Isa wrote:


Thanks for the response but I tried that and it does not work here is 
an example of names which still display.


test

sadadds

Hillary

BEN NAME

ALAN MCGARVEY +



well, at least one of those has a space inline, you didn't say that was 
acceptable, just a-z0-9
and of course, upper and lower case, so you probably should use 
[A-Za-z0-9 ]  (note the space before the close bracket)





--
john r pierce  37N 122W
somewhere on the middle of the left coast



Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

It still displaying everything, maybe it is the spaces?


test
sadadds
Hillary
BEN NAME
BOB
/+
...skipping
 ALAN MCGARVEY +

-Original Message-
From: Ian Lawrence Barwick [mailto:barw...@gmail.com] 
Sent: 12 April 2013 09:08 AM
To: Baboo, Isa
Cc: John R Pierce; pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

 From: pgsql-general-ow...@postgresql.org
 [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
 Sent: 12 April 2013 08:41 AM
 To: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] list non alphanumeric



 On 4/11/2013 11:23 PM, Baboo, Isa wrote:

 Firstly let me mention I am a noob to postgres,DB and sql anyway, I 
 have a column with First names and need to list names that have 
 non-alphanumeric characters in them like + or * and the list goes on.  
 I did google a bit and
 tried:

 select * from TABLE where first_name not like '%[a-z0-9]%';


 you'll probably have to use a regex for that.

 something like...  (my regex is really rusty)

... WHERE first_name !~ '^[a-z0-9]*$';

2013/4/12 Baboo, Isa iba...@fnb.co.za:

 Hi

 Thanks for the response but I tried that and it does not work here is 
 an example of names which still display.

 test
 sadadds
 Hillary
 BEN NAME
 ALAN MCGARVEY +

Something like:

... WHERE first_name ~ '[^\w]'

might do the trick.

Regards

Ian Barwick

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

Sorry guys I should have mention spaces, I did but it was a bit late. Anyway 
that [A-Za-z0-9 ]  worked  thanks John.


From: pgsql-general-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
Sent: 12 April 2013 09:12 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

On 4/11/2013 11:50 PM, Baboo, Isa wrote:
Thanks for the response but I tried that and it does not work here is an 
example of names which still display.

test
sadadds
Hillary
BEN NAME
ALAN MCGARVEY +

well, at least one of those has a space inline, you didn't say that was 
acceptable, just a-z0-9
and of course, upper and lower case, so you probably should use [A-Za-z0-9 ]  
(note the space before the close bracket)






--

john r pierce  37N 122W

somewhere on the middle of the left coast

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.