Gitignore Regex for numbers in a certain location

Viewed 30

Is there a .gitignore expression that would ignore this...

  • Lorem.amet.432.exe

But lets these through?...

  • Lorem.432.amet.exe
  • 432.Lorem.amet.exe

I tried *.[0-9].exe, but doesn't seem to work

1 Answers

Your try is very close to the right solution!

But here the explanation why only very close:

Your default file name (…432…) where should be ignored, has 3 numbers. So you must also add the part of [0-9] three times and not only once:

*.[0-9][0-9][0-9].exe

If the part before the three digits is also stable for ignored files, you can further restrict:

If this are only lowercase letters, add [a-z] as often as it should have letters. If there should be only capital letters write [A-Z] and if both can occur, add this[a-zA-Z].

Related