I am a bit of regex newbie and I can't figure out how to set up a regular expression for this pattern I am trying to do.
The expression is meant to be in a Python pre-commit script and it will run a pre-commit hook if the files being commits match it.
My example list of files
vars/prod-region1/mysql.yml
vars/prod-region1/keys.yml
vars/prod-region1/test.yml
vars/stage-region2/mysql.yml
vars/stage-region2/keys.yml
vars/stage-region2/test.yml
vars/local/mysql.yml
vars/local/test.yml
I need a regex pattern that will match files that fall in the following directory pattern
- vars/prod*/mysql.yml
- vars/prod*/keys.yml
- vars/stage*/mysql.yml
- vars/stage*/keys.yml
my effort at the moment is
vars/(prod*|stage*)/(mysql|keys).yml
which is severely wrong. Any help would be great.