How do I specify a case insensitive ignore?

Asked by authorunknown

Is there any way to specify a case insensitive glob in an ignore pattern, or direct the pattern matcher to construct a regex using the re.IGNORECASE flag?

This would be helpful, especially on case insensitive file systems. for example, right now my ignore files are littered with lines like:


this ignores all casings of a directory named bin, but it becomes cumbersome and ugly when the paths start getting longer

Question information

English Edit question
Bazaar Edit question
No assignee Edit question
Solved by:
Parth Malwankar
Last query:
Last reply:
Revision history for this message
Best Parth Malwankar (parthm) said :

You can use the regular expression syntax for ignore. Python allows having flags as part of the expression with extension notation[1]. For e.g. for case insensitive match for the name "foo" you could do:

bzr ignore "RE:(?i)foo"

[1] - look for "(?" on the page.

Revision history for this message
authorunknown (authorunknown) said :

Thanks Parth Malwankar, that solved my question.

Revision history for this message
authorunknown (authorunknown) said :

Thank you. I'm not very familiar with Python and couldn't find that bit of information about including the flags in the pattern string -- exactly what i needed.