From f072e3e4dda461e873c584e32bc60085b6e5560c Mon Sep 17 00:00:00 2001 From: kin ou Date: Sat, 24 Nov 2018 21:11:19 +0800 Subject: [PATCH] exercise7 --- lib/blink.js | 6 +++--- lib/capture.js | 5 +++-- lib/capture_breakword.js | 5 +++-- lib/quantified_group.js | 5 +++-- lib/quotes.js | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/blink.js b/lib/blink.js index c391a9f..ecd816f 100644 --- a/lib/blink.js +++ b/lib/blink.js @@ -2,6 +2,6 @@ var marked = require('marked') module.exports = function (str) { var md = marked(str) - // TODO - return null -} \ No newline at end of file + + return md.replace(/(@@)(.*?)(@@)/g,"$2") +} diff --git a/lib/capture.js b/lib/capture.js index a08ee57..c819265 100644 --- a/lib/capture.js +++ b/lib/capture.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /x=(\d+)/; + return str.match(regex1)?str.match(regex1)[1]:null; +} diff --git a/lib/capture_breakword.js b/lib/capture_breakword.js index a08ee57..b9b8cba 100644 --- a/lib/capture_breakword.js +++ b/lib/capture_breakword.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /\bx=(\d+)\b/; + return str.match(regex1)?str.match(regex1)[1]:null; +} diff --git a/lib/quantified_group.js b/lib/quantified_group.js index a08ee57..249fe88 100644 --- a/lib/quantified_group.js +++ b/lib/quantified_group.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /^(0x[a-fA-F\d]{2}\s*){8}$/g; + return str.match(regex1); +} diff --git a/lib/quotes.js b/lib/quotes.js index a08ee57..9860cd6 100644 --- a/lib/quotes.js +++ b/lib/quotes.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /".*?"/g; + return str.match(regex1); +}