Solved

negated character class in mysql regexp

Posted on 2010-11-24
8
341 Views
Last Modified: 2012-06-27
Hi

In mysql regexp how do you specify a negated character class? By this i mean something like

not [atcg]

i.e. anything other than those 4 letters

thanks
0
Comment
Question by:andieje
  • 5
  • 3
8 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 34210270
regexp '[^(a|t|c|g)]'

... or

not regexp '(a|t|c|g)'
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34210308
ignoring case:

regexp '[^(aA|tT|cC|gG)]'

.. or

NOT regexp '(aA|tT|cC|gG)'
0
 

Author Comment

by:andieje
ID: 34227301
hi that's not what i meant. I wanted to use the negated character class as part of a larger regular expression please.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 52

Expert Comment

by:_agx_
ID: 34235675
Depends on the existing expression.  Can you post it and describe what you're trying to add to that expression?
0
 

Author Comment

by:andieje
ID: 34248772
where column REGEXP '^[ATCG]/<negated character class goes here>'

so i want to match and a,t,c or g at the start followed by a slash followed by a character that is NOT atcg
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 34253625
WHERE column REGEXP '^[ATCG]/[^ATCG]'

0
 

Author Closing Comment

by:andieje
ID: 34262443
simple enough :)
0
 
LVL 52

Expert Comment

by:_agx_
ID: 34264007
... and almost symmetrical too :)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question