From 70e3e9a53b3cb6254372e964be4544cb802bccd2 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 11 Oct 2023 16:08:10 +0200 Subject: [PATCH] ensure variants can have modifiers in regex --- src/lib/defaultExtractor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 282cc38bc7d0..0751c1acba7e 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -80,12 +80,18 @@ function* buildRegExps(context) { // This is here to provide special support for the `@` variant regex.pattern([/@\[[^\s"'`]+\](\/[^\s"'`]+)?/, separator]), + // With variant modifier (e.g.: group-[..]/modifier) + regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/\w+/, separator]), + regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/, separator]), regex.pattern([/[^\s"'`\[\\]+/, separator]), ]), // With quotes allowed regex.any([ + // With variant modifier (e.g.: group-[..]/modifier) + regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s`]+\]\/\w+/, separator]), + regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s`]+\]/, separator]), regex.pattern([/[^\s`\[\\]+/, separator]), ]),