add: content for challenge - match ending string patterns (#31774)
This commit is contained in:
committed by
Randell Dawson
parent
bdc7c22ee6
commit
41314f1364
@ -3,8 +3,21 @@ title: Match Ending String Patterns
|
|||||||
---
|
---
|
||||||
## Match Ending String Patterns
|
## Match Ending String Patterns
|
||||||
|
|
||||||
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/javascript-algorithms-and-data-structures/regular-expressions/match-ending-string-patterns/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
|
|
||||||
|
|
||||||
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
|
To finish this challenge, it's necessary to use __boundaries__.
|
||||||
|
|
||||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
The __$__ Matches end of input.
|
||||||
|
|
||||||
|
For example, /t$/ does not match the "t" in "eater", but does match it in "eat".
|
||||||
|
|
||||||
|
|
||||||
|
__important:__ If the multiline flag is set to true, also matches immediately before a line break character.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Spoiiler Alert: Solution ahead
|
||||||
|
```javascript
|
||||||
|
let caboose = "The last car on a train is the caboose";
|
||||||
|
let lastRegex = /caboose$/; // Change this line
|
||||||
|
let result = lastRegex.test(caboose);
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user