Skip to content

Commit

Permalink
fix passing of literal backslash
Browse files Browse the repository at this point in the history
  • Loading branch information
w-e-w committed Nov 21, 2024
1 parent cd869bb commit 4418b54
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// If there's a mismatch, the keyword counter turns red and if you hover on it, a tooltip tells you what's wrong.

function checkBrackets(textArea, counterElt) {
var counts = {};
(textArea.value.match(/(?<!\\)[(){}[\]]/g) || []).forEach(bracket => {
counts[bracket] = (counts[bracket] || 0) + 1;
const counts = {};
textArea.value.matchAll(/(?<!\\)(?:\\\\)*?([(){}[\]])/g).forEach(bracket => {
counts[bracket[1]] = (counts[bracket[1]] || 0) + 1;
});
var errors = [];
const errors = [];

function checkPair(open, close, kind) {
if (counts[open] !== counts[close]) {
Expand Down

0 comments on commit 4418b54

Please sign in to comment.