I realise that this is in a different part of the forum, but there are posting guidelines at http://regexadvice.com/forums/thread/41315.aspx which tell you the type of information we need so that we can help you properly.
I'm not sure what you are really asking, but there are some simple suggesitons I can make.
Firstly, if you have a regex that matches some text, then code of the form (pseudo-code):
if( regex.matches(pattern, options, text)
{
-- do something if the regex pattern matches the text
}
then you can reverse the logic with:
if( not regex.matches(pattern, options, text)
{
-- do something if the regex pattern does not match the text
}
Please be aware that it is not possible to match a URL with regex pattern 100% of the time - one of the regular guru's here (mash) has given accuracies of 50% at most. For example, the pattern you have provided matches any string of characters made up of alphanumeric characters, a full stop and a dash that ends in one of the common domain names. However, a valid URL might be
abc.def.com/
and this would not match and yot may well cause the same problem as
abc.def.com
which would be matched.
My experience is that validations are often better approached from the 'what do we allow' than from 'what don't we allow' - the former is nearly always more restrictive and therefore often closer to the real (but unstated) need.
Susan