Forum Moderators: coopster

Message Too Old, No Replies

mysql, SELECT anything that's not A-Z%

         

brotherhood of LAN

6:25 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



no database forum yet eh ;) Hope this is still the best forum for this...

I've never used mySQL regex but I'm thinking this is the answer for this.

I have a glossary, with links to terms in the A to Z range, but some of the dictionary terms begin with a number or a non-alphanumeric. What would be the best way to select these from a table?

coopster

11:25 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would think that, at least for the ISO-8859-1 (Latin1) character set, you could

SELECT * FROM table WHERE LEFT(value, 1) NOT BETWEEN 'A' AND 'Z'

brotherhood of LAN

11:53 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thanks, that works great

dcrombie

9:54 am on Dec 16, 2003 (gmt 0)



Or in Postgres:

SELECT * FROM table WHERE value!~*'^[A-Z]';
;)