pgxnclient and beta version

If you, like me, are addicted to terminal mode, you surely love a tool like pgxnclient that allows you to install extension into PostgreSQL from the command line, much like cpan (and friends) does for Perl. A few days ago, I run into a problem: the `load** command cannot work against a PostgreSQL 11 beta 2 server. At first I reported it with a [ticket])https://github.com/dvarrazzo/pgxnclient/issues/29), but then curiosity hit me and I decided to give a look at very well written source code. Warning: I’m not a Python developer, or better, I’m a Python-idiot! This means the work I’ve done, even if it seems it works, could be totally wrong, so reviews are welcome. First I got to the regular expression used to parse a version() output:
m = re.match(r'\S+\s+(\d+)\.(\d+)(?:\.(\d+))?', data)
where data is the output of a SELECT version();. Now, this works great for a version like 9.6.5 or 10.3, but does not work for 11beta2. Therefore, I decided to implement a two level regular expression check: at first search for a two or three numbers, and if it fails, search for two numbers separated by the beta text string.
 m = re.match(r'\S+\s+(\d+)\.(\d+)(?:\.(\d+))?', data)
 if m is None:
     m = re.match( r'\S+\s+(\d+)beta(\d+)', data )
     is_beta = True
     if m is None:
         raise PgxnClientException(
             "cannot parse version number from '%s'" % data)
 else:
    is_beta = False
Apparently it works, but I’m not sure if there are not other pieces of code that need more attention.

The article pgxnclient and beta version has been posted by Luca Ferrari on August 7, 2018