From d091251a08a0b2e6620ca1959ecd1ac744c32bd5 Mon Sep 17 00:00:00 2001 From: kin ou Date: Sat, 24 Nov 2018 14:30:53 +0800 Subject: [PATCH] exerclse5 --- lib/anchor_end.js | 5 +++-- lib/anchor_start.js | 7 +++++-- lib/char_class.js | 5 +++-- lib/negated_char_class.js | 5 +++-- test/test.js | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/anchor_end.js b/lib/anchor_end.js index 56e8b85..0cd272d 100644 --- a/lib/anchor_end.js +++ b/lib/anchor_end.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TOOD -} \ No newline at end of file + var regex1 = /BANANAS$/; + return regex1.exec(str); +} diff --git a/lib/anchor_start.js b/lib/anchor_start.js index 56e8b85..6f016c6 100644 --- a/lib/anchor_start.js +++ b/lib/anchor_start.js @@ -1,3 +1,6 @@ module.exports = function (str) { - // TOOD -} \ No newline at end of file + + var regex1 = /^LITERALLY/; + return regex1.exec(str); + +} diff --git a/lib/char_class.js b/lib/char_class.js index a08ee57..991f557 100644 --- a/lib/char_class.js +++ b/lib/char_class.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /^[ac-z\d]/; + return regex1.test(str); +} diff --git a/lib/negated_char_class.js b/lib/negated_char_class.js index a08ee57..902954f 100644 --- a/lib/negated_char_class.js +++ b/lib/negated_char_class.js @@ -1,3 +1,4 @@ module.exports = function (str) { - // TODO -} \ No newline at end of file + var regex1 = /^\D(?![A-Z])/ + return regex1.test(str); +} diff --git a/test/test.js b/test/test.js index 4935e28..b113b8b 100644 --- a/test/test.js +++ b/test/test.js @@ -129,4 +129,4 @@ describe('regex', function () { `...` ) }) -}) \ No newline at end of file +})