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.
Merge pull request #44 from xavery/master

Supplemental fix for JENKINS-21609