From 413ee2b3de603b92f8ac313c24909617ce48c624 Mon Sep 17 00:00:00 2001 From: ph1p Date: Tue, 31 Aug 2021 13:53:54 +0200 Subject: [PATCH] refactor(regex): simplify regular expression --- src/helpers/comment-parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/comment-parser.ts b/src/helpers/comment-parser.ts index c87f92e..65ec8bc 100644 --- a/src/helpers/comment-parser.ts +++ b/src/helpers/comment-parser.ts @@ -2,7 +2,7 @@ import fm from 'front-matter'; const parseComment = (fileContent: string) => { try { - const allCommentBlocks = fileContent.match(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/g); + const allCommentBlocks = fileContent.match(/\/*[\s\S]*\/.*/g); const vuepressBlock = allCommentBlocks?.filter((block: string) => { return block.split('\n').filter(line => line.indexOf('@vuepress') >= 0).length; })[0];