I wanted to be able to query the document to see what variables were within it to then know which ones to assign. For this purpose I needed a getVars() function to get all existing variables inside the contentXml.
I also noticed a printVars() function so created a printOdfVars() function to complement getVars(). Difference between printVars() and printOdfVars() is that the former only prints defined/set, the latter prints all.
For the getVars() function it attempts 4 different regular expression delimiters before producing an error since there is no control over what someone is using as a variable delimiter which can in turn break the regular expressions. The regex delimiters it tries are: /, @, §, and °
Finally I have simply attached the code in a txt file as I would rather let one of the developers choose where it goes in existing code, also I am not running SVN.