By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,185 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,185 IT Pros & Developers. It's quick & easy.

regular expression issue

P: n/a
I am trying to exclude all strings that has 'a' inside (I have
simplified the actual problem)
select 1
where 'bb b a dfg' like '%[^a]%'

However, the above does not work. By the way, I can not use 'not like'
such as:

select 1
where 'bb b a dfg' not like '%a%'
Although the above will work but the idea is that I have to use 'like'
and not 'not like'. This is partly because I have to exclude rows from
an exclusion table (a table that has many rows that will be excluded).
Actually I want to include all srings that has lets say // in it using
a regular expression. I would like to write it as (I am sure it will
not work):
select 1
where column like '%[^/][^/]%'

That should exclude strings like: 'aaa // aa aa' or 'bb bbb // bb' etc
and include strings like: 'aaa aa aa' or 'bb aa nn' etc

Is there any way to write a regular expression to do it? Otherrwise I
have to solve this problem without using regular expressions in the
exclusion table.
Thanks.

Nov 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The problem you pose requires NOT LIKE. There is no way to express a
LIKE string with the "not" test inside that will do what was
specified. The NOT has to be outside.

Roy Harvey
Beacon Falls, CT
On 7 Nov 2006 21:07:01 -0800, ot*******@yahoo.com wrote:
>I am trying to exclude all strings that has 'a' inside (I have
simplified the actual problem)
select 1
where 'bb b a dfg' like '%[^a]%'

However, the above does not work. By the way, I can not use 'not like'
such as:

select 1
where 'bb b a dfg' not like '%a%'
Although the above will work but the idea is that I have to use 'like'
and not 'not like'. This is partly because I have to exclude rows from
an exclusion table (a table that has many rows that will be excluded).
Actually I want to include all srings that has lets say // in it using
a regular expression. I would like to write it as (I am sure it will
not work):
select 1
where column like '%[^/][^/]%'

That should exclude strings like: 'aaa // aa aa' or 'bb bbb // bb' etc
and include strings like: 'aaa aa aa' or 'bb aa nn' etc

Is there any way to write a regular expression to do it? Otherrwise I
have to solve this problem without using regular expressions in the
exclusion table.
Thanks.
Nov 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.