diff --git a/conda/clean-betas.py b/conda/clean-betas.py
index f424326be966b0e38ecba4dce26f2091c383c2dd..66a18211f867469da4cf7bf75f1bb9a15b3c06e6 100755
--- a/conda/clean-betas.py
+++ b/conda/clean-betas.py
@@ -9,7 +9,7 @@ import sys
 from distutils.version import StrictVersion
 
 
-package_regex = re.compile(r'(P<name>\S+)-(P<version>\d+\.\d+\.\d+\.[abc]\d+)-(P<hash>(py\d\d)?h\d{7})_(P<build>\d+)(P<extension>\.tar\.bz2)')
+package_regex = re.compile(r'^(?P<name>\S+)-(?P<version>\d+\.\d+\.\d+[abc]\d+)-(?P<hash>(py\d\d)?h[0-9a-f]{7})_(?P<build>\d+)(?P<extension>\.tar\.bz2)$')
 
 
 def check_regex():
@@ -18,20 +18,20 @@ def check_regex():
 
   def _check(s, name, version, _hash, build, ext):
     m = package_regex.match(s)
-    assert m is not None
-    assert m.group('name') == name
-    assert m.group('version') == version
-    assert m.group('hash') == _hash
-    assert m.group('build') == build
-    assert m.group('extension') == ext
+    assert m is not None, 'expected match for %s' % s
+    assert m.group('name') == name, '%r != %r' % (m.group('name'), name)
+    assert m.group('version') == version, '%r != %r' % (m.group('version'), version)
+    assert m.group('hash') == _hash, '%r != %r' % (m.group('hash'), _hash)
+    assert m.group('build') == build, '%r != %r' % (m.group('build'), build)
+    assert m.group('extension') == ext, '%r != %r' % (m.group('extension'), ext)
 
 
   # This regexp must match the following examples:
   _check('docs-2018.02.21b0-h7a51f39_0.tar.bz2', 'docs', '2018.02.21b0',
-      'h7a51f36', '0', '.tar.bz2')
+      'h7a51f39', '0', '.tar.bz2')
 
   _check('docs-with-dashes-2018.02.21b0-h7a51f39_0.tar.bz2',
-      'docs-with-dashes', '2018.02.21b0', 'h7a51f36', '0', '.tar.bz2')
+      'docs-with-dashes', '2018.02.21b0', 'h7a51f39', '0', '.tar.bz2')
 
   _check('bob.sp-2.0.11b0-py27h21b2d43_7.tar.bz2', 'bob.sp', '2.0.11b0',
       'py27h21b2d43', '7', '.tar.bz2')
@@ -43,7 +43,7 @@ def check_regex():
     '2.5.0b0', 'py36h81a6768', '11', '.tar.bz2')
 
   _check('bob.ip.caffe_extractor-1.1.2b0-py27hc65a447_0.tar.bz2',
-      'bob.ip.caffe_extractor', '1.1.2b0', 'py27hc65a447', '0', 'tar.bz2')
+      'bob.ip.caffe_extractor', '1.1.2b0', 'py27hc65a447', '0', '.tar.bz2')
 
   _check('bob.db.msu_mfsd_mod-2.2.4b0-py27h2410e3f_2.tar.bz2',
       'bob.db.msu_mfsd_mod', '2.2.4b0', 'py27h2410e3f', '2', '.tar.bz2')
@@ -96,10 +96,11 @@ def main(scandir, dry_run):
 
 if __name__ == '__main__':
 
+  #check_regex()
+
   if len(sys.argv) not in (2,3) or sys.argv[1] in ('-h', '--help'):
     print ("usage: %s <dir> [run]" % sys.argv[0])
     print ("When no command line argument is specified, this script is executed in dry-run mode (i.e., it does not actually delete files). Add option 'run' to actually delete the files.")
     sys.exit(1)
 
-  #check_regex()
   main(sys.argv[1], len(sys.argv) != 3 or sys.argv[2] != 'run')