I'm not looking to brute this to work, with a workaround, I am interested in learning why it failed.
I am trying to match all occurrences of a comma or period NOT followed by a space.
I used this patt: ([.,]+)(?! )
It should match only two cases in this string:
This is a test... And,another test.
It should match the , between And and another AND it should match the final period of the sentence. HOWEVER it is also matching the first two dots of the triple dots. .... Shouldn't the + make it greedy so it see the tripple dots is followed by a space and not match it?
Screenshot:

Your regex ([.,]+)(?! ) matches .. in ... because of backtracking. It happens when a regex may match a part of the string in different ways, and it is the case when you use quantifiers and lookarounds. Here, the engine matches ... and checks if there is a space. There is a space after ... in your string, thus, the match is failed, but the regex engine knows there is another possible way to match at the current location, and backtracks. It discards the final . from the match and checks if the second . in ... is not followed with a space. It is not, there is a . after it. So, .. are matched.
You can use an atomic group workaround here:
/(?=([.,]+))\1(?! )/g
See the regex demo
One or more dots or commas are captured inside a lookahead and then \1 consumes the text. Since there is no backtracking possible into backreferences, the negative lookahead is checked after the last . or , and if there is a space, fail occurs and the preceding . or , are not checked.
A better way for a JS regex engine to match what you want is to include the . and , into the negative lookahead condition (see Pavneet's suggestion):
/[.,]+(?![ .,])/g
^^^^^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With