This article is kind of a bait and switch actually. It first states:
>we want to match Tarzan except when this exact word is in double-quotes
and so the reader might start thinking of ways to "match" this. The author then starts to mention ways to do this, but at the end, their trick is actually to not "match" it, but to remember it in a group. This will not match what the author says it will match, because if you do regex.test(string) it will return true when "Tarzan" appears, because it is in the or statement.
It appears the author is very good at storying-telling though.
>we want to match Tarzan except when this exact word is in double-quotes
and so the reader might start thinking of ways to "match" this. The author then starts to mention ways to do this, but at the end, their trick is actually to not "match" it, but to remember it in a group. This will not match what the author says it will match, because if you do regex.test(string) it will return true when "Tarzan" appears, because it is in the or statement.
It appears the author is very good at storying-telling though.