class SonarVersionExtractor {

    public String welcomePageVersion(URL url) {
        try {
            byte[] byteArray = ByteStreams.toByteArray(url.openStream());
            String htmlContent = new String(byteArray);
            Pattern p = Pattern.compile(".* - v\\.([0-9]\\.[0-9]*.[0-9]*) - .*");
            Matcher m = p.matcher(htmlContent);
            while (m.find()) {
                return m.group(1);
            }
        } catch (IOException e) {
            return "unknown";
        }
        return "unknown";
    }

}