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

Exclude word in regular expression

P: n/a
In VB.NET I am trying to create a regular expression that will
validate any string as long as it does not contain a specified string.

For example, I want to match any word that does not contain the
following strings:

"--" or "/*"

My main purpose is to not allow string that have Oracle comments in
them.
So a valid string would be:

"asdasd" or "asda-s_d" or "a/da*s_d"

An invalid string would be:

"asdasd--" or "asdasd/*asda"

So far I've tried this:

^[\w\W]+[^--/\*]$

But this excludes strings like "asdasd-" or "as/asd", which is not
what I want. So my basic question is how do I group the exclusion
part of the regexp to exclude strings that contain "--" or "/*"?
Thanks in advance.
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.