You could also quotemeta the whole string. Then there's no need to manually escape the parenthesis:
qr/\QCannot find directory(ies): $bad_gitdir\E/or maybe even
qr/ \QCannot find directory(ies): $bad_gitdir\E /xms(The \E terminates the escaping - in case you want to add something else later on.)
In reply to Re^2: Unterminated \g... pattern in regex behaving badly on Windows
by Monk::Thomas
in thread Unterminated \g... pattern in regex behaving badly on Windows
by jkeenan1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |