Cherry pick change to url matching regular expression. Fixes LMS-37

@nedbat @brianhw: Please review?