Creating nested list comprehension of files starting with specific string
Review


Bug on Capitalization

mm = regex.match('^([a-z]+)([0-9]{4,5})|^([a-z]+)', input)


This does not work for the given use case of California1998

But it can be easily fixed by adjusting the regex to include [A-Za-z] capital letters
Stop overshadowing!

You use multiple built-in keywords as variable names ie, input dir this makes it that the overshadowed functions can no longer be used further in the program
import regex? 

I think this should be import re, since that's what the library is called
Unnecesarry operations

The sort and consecutive conversion do nothing at all

Secondly you loop over the directory twice! This can be avoided by doing it one loop.
Don't print errors raise them

And make sure the user get's back useful information in the error message this generic message is not very helpful :)


Alternative

Look into the glob module this does what you require, 

&gt;&gt;&gt; import glob
&gt;&gt;&gt; glob.glob("./California1998*")
['./California1998_reform_paper.jpg', './California1998_reform_paper.txt', './California1998_reform_paper.pdf']