0

I think this should have been answered many times but I just can't find an answer specific enough.

I'm using a python linting tool that only has a 'match' regular expression (no excludes). So the expression to match any python file in the working directory is currently

match=^.*\.py$

However there's a limitation in the linter and it fails when files have bad permissions. I'm not interested in reasons I just want the linter to ignore those files via the match regex.

So how can I create a regex expression for the match such that for the following :

foo.py
/blah/bar.py
/som/dir/gnar.py
/an/dir/IGNOREME.py
/an/other/dir/IGNOREME.py
/foo.notgoodext

matches everything with a .py extension EXCEPT when the filename is IGNOREME (in any directory)

So it will match the first, second and third file, but not the last three

I know this has something to do with 'negative lookahead' but I just can't get it to work!

Richard
  • 884
  • 8
  • 18

0 Answers0