The `toRegex` function does not escape the delimiter it itself uses, `#`. See related issues in Composer: https://github.com/composer/composer/issues/3408 https://github.com/composer/composer/pull/3380