I believe you can use a java service to extract the document information.
Give the java service the following inputs :
document and the varibale field name u want to extract the value
Use the below java service. THis service has got inputs namely “tempDoc” and “key” and gives an output “value”
If you convert your document to a node using pub.xml:documentToXMLNode, you can use pub.xml:queryXMLNode to locate variables using regular expressions.
See this post for a couple of examples of XQL queries that will do this.