replace regexp global in #url_for
don't cache invalid subsets when preloading hmt associations.

closes #8423.
Merge pull request #9252 from senny/8423_hmt_preloading_bug

don't cache invalid subsets when preloading hmt associations
Merge pull request #8704 from senny/remove_regexp_global_from_url_for

replace regexp global in #url_for