Url pattern matching

@rcrichton please test review 
I don't think that we will need this confirm call with the changes I mention below.