.hgignore not matching / with negative look-ahead

31 Views Asked by At

I want to use this pattern in my .hgignore:

syntax: regexp

(?<![^/])\.(?!(idea|yarn)/)

i.e. match all files/directories starting with a . other than the .idea/ and .yarn/ directories.

However, when I run hg status -n --color=no, my .idea files aren't listed.

If I change that last / to \b then I get:

.idea/blade.xml
.idea/codeStyleSettings.xml
.idea/codeStyles/Project.xml
.idea/codeStyles/codeStyleConfig.xml
.idea/copyright/profiles_settings.xml

\b is probably close enough to what I want, but I can't understand why it won't work with . when the status list clearly shows files with .idea/.

Regex101 also shows that it should work.

Match (note the "x"):

enter image description here

Doesn't match (as intended, because it's negated):

enter image description here

0

There are 0 best solutions below