tags:

views:

141

answers:

3
+9  A: 

"google" might not fit in [a-z]{2}, but it does fit in [a-z]{2}([a-zA-Z0-9\?\=\&\%\/]*)? - you forgot to require a / after the TLD if the URL extends beyond the domain. So it's interpreting it with "www.go" as the domain and then "ogle" following it, with no slash in between. You can fix it by adding a [?/] to the front of that last group to require one of those two symbols between the TLD and any further portion of the URL.

Amber
tsilb
@tslib: it is as in fact not a valid url.
Residuum
@Residuum: Then why does C#'s Request.Querystring[] pick it up? :)
tsilb
@tsilb: Your example is in fact a valid URL. There was a question regarding that exact case here on SO a few days ago, but since it's essentially impossible to search for "com?" I'm afraid I can't find a link to it.
Greg Hewgill
tsilb: there's a reason why I recommended adding `[?/]` and not just `/` - because either would be valid.
Amber
+2  A: 

Your TLD clause matches "go" in google and the querystring support part matches "ogle" afterwards. Try changing the querystring part to this:

([?/][a-zA-Z0-9\?\=\&\%\/]*)?
Kaivosukeltaja
Bah, that's right, when I removed the specifically-formatted querystring stuff (Failures, figured I'd fix it after the rest of it works), I forgot it no longer delimits on the question mark!
tsilb
+2  A: 

google" doesn't fit into the "[a-z]{2}" clause.

But "go" does and then "ogle" matches "([a-zA-Z0-9\?\=\&\%\/]*)?"

AnthonyWJones