tags:

views:

34

answers:

2

I want to match a URL that contains any sequence of valid URL characters but not a particular word. The URL in question http://gateway.ovid.com and I want to match anything but the word 'gateway' so:

but

Something like the following:

^http://([a-z0-9\-\.]+|(?<!gateway))\.ovid\.com$

but it doesn't seem to work.


Update: Sorry forget to mention the language, it's C#.NET

A: 

You didn't specify host language, but why not something like this psuedocode

bool good = Regex.Match( yourRegex ) and not Regex.Match(gateway)
BioBuckyBall
+4  A: 

Your regex is almost correct except the extra '|' after '+'. Remove the '|'

^http://([a-z0-9\-\.]+(?<!gateway))\.ovid\.com$
Gopi
Awesome! That works perfectly. I was trying every combination I could think of as well.
Sunday Ironfoot