Having regex_matches exclude cases where both capturing groups match a 0-length string I'll trying to write a regex pattern that will help me create an array of length 2 arrays such that each inner array is matched like so:
I'm looking to split sequences that begin with a positive or negative integer followed by a sequence of letters and periods that begins with a letter.  Neither the integer nor sequence of letters/periods is required, but at least one should be for it to match.
I don't know that that's a very clear description, so here's an example.  The string '9a.-16.y -y. -7hello world' should return {{9, a.},{-16,},{,y},{,y.},{-7,hello},{,world}}.
I've gotten pretty close with the following code
select array(
  select regexp_matches(
    '9a.-16.y -y. -7hello world',
    '(-\d+|\d*)([a-zA-Z][a-zA-Z.]*|)',
    'g'
));

But it's including cases where neither capturing group matches.
{{9,a.},{-16,},{,},{,y},{,},{,},{,y.},{,},{-7,hello},{,},{,world},{,}}
I can get this by making the whole preface digit optional and ignoring the trailing pipe you put in the last group, I think you can remove the NULLs after by another process:
select array(
  select regexp_matches(
    '9a.-16.y -y. -7hello world',
    '(-\d+|\d+)?([a-zA-Z][a-zA-Z.]*)',
    'g'
));
                        array                        
-----------------------------------------------------
 {{9,a.},{NULL,y},{NULL,y.},{-7,hello},{NULL,world}}