--- id: 587d7db7367417b2b2512b9e title: Match Ending String Patterns challengeType: 1 videoUrl: '' localeTitle: تطابق نهاية أنماط سلسلة --- ## Description
في التحدي الأخير ، تعلمت استخدام caret للبحث عن الأنماط في بداية السلاسل. هناك أيضًا طريقة للبحث عن الأنماط في نهاية السلاسل. يمكنك البحث في نهاية السلاسل باستخدام حرف dollar sign $ في نهاية التعليمة regex.
دع theEnding = "هذه قصة لا تنتهي أبدا"؛
let storyRegex = / story $ /؛
storyRegex.test (theEnding)؛
// يعود صحيح
let noEnding = "في بعض الأحيان يجب أن تنتهي القصة" ؛
storyRegex.test (noEnding)؛
// إرجاع خاطئة
## Instructions
استخدم حرف الربط ( $ ) لمطابقة السلسلة "caboose" في نهاية سلسلة caboose .
## Tests
```yml tests: - text: يجب عليك البحث عن "caboose" باستخدام علامة الدولار $ anchor في تعبيرك المعتاد. testString: 'assert(lastRegex.source == "caboose$", "You should search for "caboose" with the dollar sign $ anchor in your regex.");' - text: يجب ألا يستخدم تعبيرك المعتاد أي أعلام. testString: 'assert(lastRegex.flags == "", "Your regex should not use any flags.");' - text: يجب أن تتطابق مع "caboose" في نهاية السلسلة "The last car on a train is the caboose" testString: 'assert(lastRegex.test("The last car on a train is the caboose"), "You should match "caboose" at the end of the string "The last car on a train is the caboose"");' ```
## Challenge Seed
```js let caboose = "The last car on a train is the caboose"; let lastRegex = /change/; // Change this line let result = lastRegex.test(caboose); ```
## Solution
```js // solution required ```