diff --git a/src/PHPWord/Template.php b/src/PHPWord/Template.php index 150676f779..832776c3ab 100644 --- a/src/PHPWord/Template.php +++ b/src/PHPWord/Template.php @@ -91,7 +91,14 @@ public function setValue($search, $replace) { $this->_documentXML = str_replace($search, $replace, $this->_documentXML); } - + /** + * Returns array of all variables in template + */ + public function getVariables() + { + preg_match_all('/\$\{(.*?)}/i', $this->_documentXML, $matches); + return $matches[1]; + } /** * Save Template *