use a number of methods to try to find a build number in a form

including pattern matching in the meta.appVersion.#text
and pull this out for reuse

The only difference here is that it now looks for the build version in the appVersion text first before looking at the form version. Potential issues are (1) that I could have overlooked something in the various formats of appVersion, which could result in pulling out the wrong number and (2) that the form version is often behind the build version (i.e. if the form didn't change the `@version` attribute won't change either), which means that this change will actually make that more correct.

fixes: http://manage.dimagi.com/default.asp?73618