diff --git a/lib/blink.js b/lib/blink.js index c391a9f..407101d 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 + var regex = /@@([\w\W]+?)@@/g; + return md.replace(regex, '$1'); } \ No newline at end of file diff --git a/lib/capture.js b/lib/capture.js index a08ee57..44319d4 100644 --- a/lib/capture.js +++ b/lib/capture.js @@ -1,3 +1,5 @@ module.exports = function (str) { // TODO + var res=str.match(/\bx=(\d+)\b/) + return res&&res[1]; } \ No newline at end of file diff --git a/lib/capture_breakword.js b/lib/capture_breakword.js index a08ee57..dff14a8 100644 --- a/lib/capture_breakword.js +++ b/lib/capture_breakword.js @@ -1,3 +1,8 @@ module.exports = function (str) { // TODO + if(str.match(/(\bx=)+(\d{1,}\b)/)){ + return str.match(/(\bx=)+(\d{1,}\b)/)[2] + }else{ + return null; + } } \ No newline at end of file diff --git a/lib/quantified_group.js b/lib/quantified_group.js index a08ee57..61ef4f5 100644 --- a/lib/quantified_group.js +++ b/lib/quantified_group.js @@ -1,3 +1,4 @@ module.exports = function (str) { // TODO + return /^(0x[0-9a-fA-F]{2}\s+){8}$/.test(str); } \ No newline at end of file diff --git a/lib/quotes.js b/lib/quotes.js index a08ee57..40e36d6 100644 --- a/lib/quotes.js +++ b/lib/quotes.js @@ -1,3 +1,5 @@ module.exports = function (str) { // TODO + let arr=str.match(/\"([^\"]*)\"/g) + return arr; } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5156ed0 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "exercise7", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "marked": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", + "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", + "dev": true + } + } +} diff --git a/package.json b/package.json index bd82faa..1834aee 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/FE-star/exercise7#readme", "devDependencies": { - "marked": "^0.3.6", + "marked": "^0.3.19", "mocha": "^3.5.0" } }