Solved

negated character class in mysql regexp

Posted on 2010-11-24
8
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 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