Supplemental fix for JENKINS-21609

The previous fix did not take into account the existence of multiple sequences
of [xyz] in the path. This commit fixes this.