From 61a184bd3748db5142c316238c03547865787a94 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Sun, 27 Mar 2022 20:37:58 -0700 Subject: [PATCH] avoid backtracking --- src/color.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/color.js b/src/color.js index 036d9f4..3e3ad49 100644 --- a/src/color.js +++ b/src/color.js @@ -6,8 +6,8 @@ export var darker = 0.7; export var brighter = 1 / darker; var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", + reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", + reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),