var R = /([^])\1+/g
I’ve found that this regular expression R is used to match repeating characters in a string.
e.g “HazzzeLLllnut$$$”.match(R) returns [“zzz”,“LL”,“ll”,"$$$"]
I can’t see how it does this? When I omit the \1+, so that the expression becomes
var R = /[^]/g
It matches every individual character in a string. I understand that the caret ^ in square brackets ([^]) means “not the following”? How does this regex work exactly and how is it matching every character?