From d5fa9c709dfdd0e081658b97640aade7fd6e373f Mon Sep 17 00:00:00 2001 From: ocean010101 Date: Sat, 6 Apr 2019 08:50:51 +0800 Subject: [PATCH] complete exercise5 Signed-off-by: ocean010101 --- lib/anchor_end.js | 8 +++++--- lib/anchor_start.js | 7 ++++--- lib/char_class.js | 7 ++++--- lib/negated_char_class.js | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/anchor_end.js b/lib/anchor_end.js index 56e8b85..95f6aeb 100644 --- a/lib/anchor_end.js +++ b/lib/anchor_end.js @@ -1,3 +1,5 @@ -module.exports = function (str) { - // TOOD -} \ No newline at end of file +function anchor_end (str) { + return /BANANAS$/.test(str); +} + +module.exports = anchor_end; \ No newline at end of file diff --git a/lib/anchor_start.js b/lib/anchor_start.js index 56e8b85..e49ad15 100644 --- a/lib/anchor_start.js +++ b/lib/anchor_start.js @@ -1,3 +1,4 @@ -module.exports = function (str) { - // TOOD -} \ No newline at end of file +function anchor_start (str) { + return /^LITERALLY/.test(str); +} +module.exports = anchor_start; \ No newline at end of file diff --git a/lib/char_class.js b/lib/char_class.js index a08ee57..93fbcae 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 +function char_class (str) { + return /^[^A-Zb]/.test(str); +} +module.exports = char_class; \ No newline at end of file diff --git a/lib/negated_char_class.js b/lib/negated_char_class.js index a08ee57..ed69d7d 100644 --- a/lib/negated_char_class.js +++ b/lib/negated_char_class.js @@ -1,3 +1,5 @@ -module.exports = function (str) { - // TODO -} \ No newline at end of file +function negated_char_class (str) { + return /\D[^A-Z]/.test(str); +} + +module.exports = negated_char_class; \ No newline at end of file