From 34e13b66d26544df828237c974c0a46ec67f95c6 Mon Sep 17 00:00:00 2001 From: Joseph Cheung Date: Sat, 24 Nov 2018 13:29:24 +0800 Subject: [PATCH 1/2] fininshed --- lib/blink.js | 3 +-- lib/capture.js | 3 ++- lib/capture_breakword.js | 3 ++- lib/quantified_group.js | 2 +- lib/quotes.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/blink.js b/lib/blink.js index c391a9f..5ad9975 100644 --- a/lib/blink.js +++ b/lib/blink.js @@ -2,6 +2,5 @@ var marked = require('marked') module.exports = function (str) { var md = marked(str) - // TODO - return null + return md.replace(/@@([^@@]+)@@/g,'$1') } \ No newline at end of file diff --git a/lib/capture.js b/lib/capture.js index a08ee57..e5b4970 100644 --- a/lib/capture.js +++ b/lib/capture.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO + var matches = /^.*x=([\d]+)/g.exec(str) + return matches ? matches[1] : null; } \ No newline at end of file diff --git a/lib/capture_breakword.js b/lib/capture_breakword.js index a08ee57..5117320 100644 --- a/lib/capture_breakword.js +++ b/lib/capture_breakword.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO + var matches = /^(.*\s+)?x=([\d]+)(\s+.*)?$/g.exec(str) + return matches ? matches[2] : null; } \ No newline at end of file diff --git a/lib/quantified_group.js b/lib/quantified_group.js index a08ee57..eaa8810 100644 --- a/lib/quantified_group.js +++ b/lib/quantified_group.js @@ -1,3 +1,3 @@ module.exports = function (str) { - // TODO + return /^(0x[\da-fA-F]{2}\s*){8}$/g.test(str) } \ No newline at end of file diff --git a/lib/quotes.js b/lib/quotes.js index a08ee57..99d154c 100644 --- a/lib/quotes.js +++ b/lib/quotes.js @@ -1,3 +1,3 @@ module.exports = function (str) { - // TODO + return str.match(/\"[^\"]*\"/g) } \ No newline at end of file From 8506904cd3a10ca59a0786952c68dfb32c6fcf5d Mon Sep 17 00:00:00 2001 From: Joseph Cheung Date: Mon, 26 Nov 2018 15:58:34 +0800 Subject: [PATCH 2/2] a better way --- lib/capture.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/capture.js b/lib/capture.js index e5b4970..8ac04e6 100644 --- a/lib/capture.js +++ b/lib/capture.js @@ -1,4 +1,3 @@ module.exports = function (str) { - var matches = /^.*x=([\d]+)/g.exec(str) - return matches ? matches[1] : null; + return str.match(/(?<=x=)\d+/) } \ No newline at end of file