* Use dfn tags * remove misused <dfn> tags * Revert "remove misused <dfn> tags" This reverts commit b24968a96810f618d831410ac90a0bc452ebde50. * Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.english.md Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Make "array" lowercase Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Fix dfn usage * Address last dfn tags
1.8 KiB
1.8 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
587d7db7367417b2b2512b9e | Match Ending String Patterns | 1 | 301352 |
Description
$
at the end of the regex.
let theEnding = "This is a never ending story";
let storyRegex = /story$/;
storyRegex.test(theEnding);
// Returns true
let noEnding = "Sometimes a story will have to end";
storyRegex.test(noEnding);
// Returns false
Instructions
$
) to match the string "caboose"
at the end of the string caboose
.
Tests
tests:
- text: You should search for <code>"caboose"</code> with the dollar sign <code>$</code> anchor in your regex.
testString: assert(lastRegex.source == "caboose$");
- text: Your regex should not use any flags.
testString: assert(lastRegex.flags == "");
- text: You should match <code>"caboose"</code> at the end of the string <code>"The last car on a train is the caboose"</code>
testString: assert(lastRegex.test("The last car on a train is the caboose"));
Challenge Seed
let caboose = "The last car on a train is the caboose";
let lastRegex = /change/; // Change this line
let result = lastRegex.test(caboose);
Solution
let caboose = "The last car on a train is the caboose";
let lastRegex = /caboose$/; // Change this line
let result = lastRegex.test(caboose);