From 65fd97401e6f7b2b46ab86b2a235111d3a82c92d Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Mon, 28 Mar 2022 09:08:43 -0700 Subject: [PATCH] avoid backtracking (#100) --- 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] + "\\)$"),