[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

negated character class in mysql regexp

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
andieje
Asked:
andieje
  • 5
  • 3
1 Solution
 
_agx_Commented:
regexp '[^(a|t|c|g)]'

... or

not regexp '(a|t|c|g)'
0
 
_agx_Commented:
ignoring case:

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

.. or

NOT regexp '(aA|tT|cC|gG)'
0
 
andiejeAuthor Commented:
hi that's not what i meant. I wanted to use the negated character class as part of a larger regular expression please.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
_agx_Commented:
Depends on the existing expression.  Can you post it and describe what you're trying to add to that expression?
0
 
andiejeAuthor Commented:
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
 
_agx_Commented:
WHERE column REGEXP '^[ATCG]/[^ATCG]'

0
 
andiejeAuthor Commented:
simple enough :)
0
 
_agx_Commented:
... and almost symmetrical too :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now