4

Editor1CurrentlyOpen[1].txt

Since regex is not effective in the .gitignore file, how can a glob encompass filenames such as the above?

5

.gitignore uses glob expressions on each line, so when you enter Editor1CurrentlyOpen[1].txt it will try to match Editor1CurrentlyOpen1.txt.

Add backslashes to mask the brackets in the entry:

Editor1CurrentlyOpen\[1\].txt
  • 1
    One can remove the special meaning of '?', '' and'[' by preceding them by a backslash, or, in case this is part of a shell command line, enclosing them in quotes. Between brackets these characters stand for themselves. Thus, "[[?*]" matches the four charac- ters '[', '?', '' and '\'. Ah! found the manpages entry for that. (unix.com/man-page/Linux/7/glob) . It had been me trying to write regexes which was both entertaining and frustrating. Now I have to figure out how to automate the .gitignore to add those slashes. – MountainMan Sep 19 '16 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.