From 0789b861b47fb59b3810efe258c2c256a234f2fa Mon Sep 17 00:00:00 2001 From: Alex Hennings Date: Fri, 10 Jul 2020 13:37:16 -0400 Subject: [PATCH] Updating regex to simplify and account for leading zeros in the element id. --- modules/ui/feature_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ui/feature_list.js b/modules/ui/feature_list.js index f6979e815..2309dd6e8 100644 --- a/modules/ui/feature_list.js +++ b/modules/ui/feature_list.js @@ -122,11 +122,11 @@ export function uiFeatureList(context) { if (!q) return result; - var idMatch = q.match(/^(.*[^\w])?(node|n|way|w|relation|r)[^\w]?([0-9]+)([^\w].*)?$/i); + var idMatch = q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i); if (idMatch) { - var elemType = idMatch[2][0]; - var elemId = idMatch[3]; + var elemType = idMatch[1].charAt(0); + var elemId = idMatch[2]; result.push({ id: elemType + elemId, geometry: elemType === 'n' ? 'point' : elemType === 'w' ? 'line' : 'relation',