diff --git a/src/utils/PhutilCowsay.php b/src/utils/PhutilCowsay.php --- a/src/utils/PhutilCowsay.php +++ b/src/utils/PhutilCowsay.php @@ -71,14 +71,15 @@ $template); } - $template = preg_replace_callback( - '/\\$([a-z]+)/', - array($this, 'replaceTemplateVariable'), - $template); - if ($template === false) { - throw new Exception( - pht( - 'Failed to replace template variables while rendering cow!')); + foreach (array('/\\$([a-z]+)/', '/\\${([a-z]+)}/') as $token_pattern) { + $template = preg_replace_callback( + $token_pattern, + array($this, 'replaceTemplateVariable'), + $template); + if ($template === false) { + throw new Exception( + pht('Failed to replace template variables while rendering cow!')); + } } $lines = $this->text;