Improved regex to better pick out variables