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:

/**/[Bb][Ii][Nn]/

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

Question information

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

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] http://docs.python.org/library/re.html - look for "(?" on the page.

Revision history for this message
authorunknown (authorunknown) said :
#2

Thanks Parth Malwankar, that solved my question.

Revision history for this message
authorunknown (authorunknown) said :
#3

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.