negation

Negate Regex in MySQL rlike Expression

I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc). Here's the regex for a positive match, I just need a way to negate it: '^.*[C][A][0-9]?$' (Due to an embarrassing architecture limitation, I don't want to use not rlike ...) ...

String negation using regular expressions

Is it possible to do string negation in regular expressions? I need to match all strings that do not contain the string "..". I know you can use ^[^\.]*$ to match all strings that do not contain "." but I need to match more than one character. I know I could simply match a string containing ".." and then negate the return value of the...

caret/negate for a word in regular expression

[^a-zA-Z] - matches anything except a,b,c,...z , A, B, ..Z I want expression that matches anything except (abc) AND except (xyz) I want a regex for image tag I tried img.*src - it matches the initial part but between img and src there should not be any other image tag so I put a caret img[^(neither <img nor src=)] how to use ^ with a...

What does !! (double exclamation point) mean?

In the code below, from a blog post by Alias, I noticed the use of the double exclamation point !!. I was wondering what it meant and where I could go in the future to find explanations for Perl syntax like this. (Yes, I already searched for '!!' at perlsyn). package Foo; use vars qw{$DEBUG}; BEGIN { $DEBUG = 0 unless defined $DEBU...

Django query negation

Hi, I know how to build filters and Q objects in django, but I don't know how to negate the operators that the API provides, for example for the contains operator I would like something like notcontains. e.g. q=Q(name__notcontains="SomeString") This would get me all objects whose name do not contain "SomeString". Is there some synt...

Algorithm for Negating Sentences

I was wondering if anyone was familiar with any attempts at algorithmic sentence negation. For example, given a sentence like "This book is good" provide any number of alternative sentences meaning the opposite like "This book is not good" or even "This book is bad". Obviously, accomplishing this with a high degree of accuracy would pr...

Turn on leftmost bit of a Short.

Original question changed. I want to bitwise turn off the left most bit of a Short value (&H8000) and leave the other bits as they are. Dim x = BitConverter.GetBytes(Short.MaxValue Or &H8000) Dim z = BitConverter.ToInt16(x, 0) Isn't there any shorter way with bitwise operators? When I do Dim a = Short.MaxValue Or &H8000 I get a c...