I now have ```(?=$|/)``` at the end that matches all cases except one. But I just found out that .hgignore files also supports regex syntax. So it seems it needs some more work....