From 38f63b5410b299bc19276c2a270678a68d630ff5 Mon Sep 17 00:00:00 2001 From: Michael Horn Date: Sat, 22 Jun 2019 16:00:24 -0700 Subject: [PATCH] Fix regex for dots and hashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, a string such as ‘#some-id.some-class’ will match as ‘some-id.some-class’, rather than just ‘some-class’ - This adjustment will match only the last substring following either a hash or a dot, and containing neither. --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 3eaa81e..bf1acc0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -44,7 +44,7 @@ class ClassServer implements vsc.CompletionItemProvider { private regex = [ /(class|id|className)=["|']([^"^']*$)/i, - /(\.|\#)[^\s]*$/i, + /(?:\.([^\s\#\.]*)$)|(?:\#([^\s\.\#]*)$)/i, /([\s\S]*)<\/style>/ig ];