Solved

negated character class in mysql regexp

Posted on 2010-11-24
8
337 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
 
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
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.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now