Url pattern matching

@rcrichton please test review