diff --git a/buildstream/_version.py b/buildstream/_version.py
index 6aeea18f960e28f45815995bc172356ed83259a1..03f946cb88bf2807e9173563984ea8863216b825 100644
--- a/buildstream/_version.py
+++ b/buildstream/_version.py
@@ -43,6 +43,7 @@ def get_config():
     cfg.VCS = "git"
     cfg.style = "pep440"
     cfg.tag_prefix = ""
+    cfg.tag_regex = "*.*.*"
     cfg.parentdir_prefix = "BuildStream-"
     cfg.versionfile_source = "buildstream/_version.py"
     cfg.verbose = False
@@ -215,7 +216,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
 
 
 @register_vcs_handler("git", "pieces_from_vcs")
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
     """Get version from 'git describe' in the root of the source tree.
 
     This only gets called if the git-archive 'subst' keywords were *not*
@@ -237,7 +238,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
     # if there isn't one, this yields HEX[-dirty] (no NUM)
     describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
                                           "--always", "--long",
-                                          "--match", "%s*" % tag_prefix],
+                                          "--match", "%s%s" % (tag_prefix, tag_regex)],
                                    cwd=root)
     # --long was added in git-1.5.5
     if describe_out is None:
@@ -505,7 +506,7 @@ def get_versions():
                 "date": None}
 
     try:
-        pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+        pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
         return render(pieces, cfg.style)
     except NotThisMethod:
         pass
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 149ee7b90a7f4affb995eff3eacab04319dd51ad..943346689c1594b236f505c691b194b6e88db434 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -484,7 +484,16 @@ def get_bst_version():
         raise UtilError("Your git repository has no tags - BuildStream can't "
                         "determine its version. Please run `git fetch --tags`.")
 
-    return (int(versions[0]), int(versions[1]))
+    try:
+        return (int(versions[0]), int(versions[1]))
+    except IndexError:
+        raise UtilError("Cannot detect Major and Minor parts of the version\n"
+                        "Version: {} not in XX.YY.whatever format"
+                        .format(__version__))
+    except ValueError:
+        raise UtilError("Cannot convert version to integer numbers\n"
+                        "Version: {} not in Integer.Integer.whatever format"
+                        .format(__version__))
 
 
 @contextmanager
diff --git a/setup.cfg b/setup.cfg
index a59d2b21427c12692369239c353ccffade2422b1..7a27a2f58ada8f21a1945da21ae215d44c77bbc5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,6 +4,7 @@ style = pep440
 versionfile_source = buildstream/_version.py
 versionfile_build = buildstream/_version.py
 tag_prefix =
+tag_regex = *.*.*
 parentdir_prefix = BuildStream-
 
 [aliases]
diff --git a/versioneer.py b/versioneer.py
index 9574c5e0a8f690a43a7e7745de8853e45b46b99b..48e9b2e25141ff93c8072553f14323597e5c42bb 100644
--- a/versioneer.py
+++ b/versioneer.py
@@ -355,6 +355,7 @@ def get_config_from_root(root):
     cfg.versionfile_source = get(parser, "versionfile_source")
     cfg.versionfile_build = get(parser, "versionfile_build")
     cfg.tag_prefix = get(parser, "tag_prefix")
+    cfg.tag_regex = get(parser, "tag_regex") or "*"
     if cfg.tag_prefix in ("''", '""'):
         cfg.tag_prefix = ""
     cfg.parentdir_prefix = get(parser, "parentdir_prefix")
@@ -463,6 +464,7 @@ def get_config():
     cfg.VCS = "git"
     cfg.style = "%(STYLE)s"
     cfg.tag_prefix = "%(TAG_PREFIX)s"
+    cfg.tag_regex = "%(TAG_REGEX)s"
     cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s"
     cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s"
     cfg.verbose = False
@@ -635,7 +637,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
 
 
 @register_vcs_handler("git", "pieces_from_vcs")
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
     """Get version from 'git describe' in the root of the source tree.
 
     This only gets called if the git-archive 'subst' keywords were *not*
@@ -657,7 +659,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
     # if there isn't one, this yields HEX[-dirty] (no NUM)
     describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
                                           "--always", "--long",
-                                          "--match", "%%s*" %% tag_prefix],
+                                          "--match", "%%s%%s" %% (tag_prefix, tag_regex)],
                                    cwd=root)
     # --long was added in git-1.5.5
     if describe_out is None:
@@ -925,7 +927,7 @@ def get_versions():
                 "date": None}
 
     try:
-        pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+        pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
         return render(pieces, cfg.style)
     except NotThisMethod:
         pass
@@ -1027,7 +1029,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
 
 
 @register_vcs_handler("git", "pieces_from_vcs")
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
     """Get version from 'git describe' in the root of the source tree.
 
     This only gets called if the git-archive 'subst' keywords were *not*
@@ -1049,7 +1051,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
     # if there isn't one, this yields HEX[-dirty] (no NUM)
     describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
                                           "--always", "--long",
-                                          "--match", "%s*" % tag_prefix],
+                                          "--match", "%s%s" % (tag_prefix, tag_regex)],
                                    cwd=root)
     # --long was added in git-1.5.5
     if describe_out is None:
@@ -1451,7 +1453,7 @@ def get_versions(verbose=False):
     from_vcs_f = handlers.get("pieces_from_vcs")
     if from_vcs_f:
         try:
-            pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
+            pieces = from_vcs_f(cfg.tag_prefix, cfg.tag_regex, root, verbose)
             ver = render(pieces, cfg.style)
             if verbose:
                 print("got version from VCS %s" % ver)
@@ -1586,6 +1588,7 @@ def get_cmdclass():
                             {"DOLLAR": "$",
                              "STYLE": cfg.style,
                              "TAG_PREFIX": cfg.tag_prefix,
+                             "TAG_REGEX": cfg.tag_regex,
                              "PARENTDIR_PREFIX": cfg.parentdir_prefix,
                              "VERSIONFILE_SOURCE": cfg.versionfile_source,
                              })
@@ -1615,6 +1618,7 @@ def get_cmdclass():
                             {"DOLLAR": "$",
                              "STYLE": cfg.style,
                              "TAG_PREFIX": cfg.tag_prefix,
+                             "TAG_REGEX": cfg.tag_regex,
                              "PARENTDIR_PREFIX": cfg.parentdir_prefix,
                              "VERSIONFILE_SOURCE": cfg.versionfile_source,
                              })
@@ -1716,6 +1720,7 @@ def do_setup():
         f.write(LONG % {"DOLLAR": "$",
                         "STYLE": cfg.style,
                         "TAG_PREFIX": cfg.tag_prefix,
+                        "TAG_REGEX": cfg.tag_regex,
                         "PARENTDIR_PREFIX": cfg.parentdir_prefix,
                         "VERSIONFILE_SOURCE": cfg.versionfile_source,
                         })