MudGuard wrote:[^/] matches exactly one character that is not a /
I know. I first found the bug because I
was using
[~/]$ and it kept matching line 4. It was only after I discovered that adding a
. in front of it gave correct results on PC that I got confused and started thinking that maybe [~/] could match an empty string.
Let's start over. Create the following 5 line file (last line is empty):
And save 2 copies of it, one as file type "PC" and one as "UNIX".
Testcase #1
Use this regex to find all non-empty lines NOT ending with '/'. This should only match line 2:
Both the PC and Unix files will match line 2 (as they should),
but they ALSO match line 4 (which they should not).
Testcase #2
Now use this regex, which should match any line of length 2 or greater, not ending in '/'. Again, this should only match line 2:
The PC file now only matches line 2 (as it should), but the Unix file still also matches line 4 (still wrong). That this testcase works differently on PC vs Unix files may provide some clue to understanding the bug.