targetId should be found using the capturing group rather than the current way. This would work for all URLs while the current code is broken for href that include the page URL