This Gist contains handy snippets for extracting just the version number from various application version strings.
At the time of writing, the majority of these snippets were created for applications installed on a MAC via Homebrew. Please feel free to provide snippets for unsupported setups if required.