From d2bb6f1bd032ca6acb698d64241be401066f7eef Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 4 Dec 2023 11:23:33 -0500 Subject: [PATCH] Fix candidate detection regex --- src/lib/defaultExtractor.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 75ee8af50..3a1ff321e 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -47,7 +47,12 @@ function* buildRegExps(context) { regex.any([ regex.pattern([ // Arbitrary values - /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/, + regex.any([ + /-(?:\w+-)*\['[^\s]+'\]/, + /-(?:\w+-)*\["[^\s]+"\]/, + /-(?:\w+-)*\[`[^\s]+`\]/, + /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/, + ]), // Not immediately followed by an `{[(` /(?![{([]])/, @@ -58,7 +63,12 @@ function* buildRegExps(context) { regex.pattern([ // Arbitrary values - /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/, + regex.any([ + /-(?:\w+-)*\['[^\s]+'\]/, + /-(?:\w+-)*\["[^\s]+"\]/, + /-(?:\w+-)*\[`[^\s]+`\]/, + /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s\[\]]+\]/, + ]), // Not immediately followed by an `{[(` /(?![{([]])/,