2018-10-04 14:47:55 +01:00
|
|
|
---
|
|
|
|
title: Match Ending String Patterns
|
|
|
|
---
|
|
|
|
## Match Ending String Patterns
|
|
|
|
|
|
|
|
|
2019-03-08 23:50:49 +01:00
|
|
|
To finish this challenge, it's necessary to use __boundaries__.
|
2018-10-04 14:47:55 +01:00
|
|
|
|
2019-03-08 23:50:49 +01:00
|
|
|
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);
|
|
|
|
```
|