2.6 KiB
2.6 KiB
id, title, challengeType, videoUrl, localeTitle
| id | title | challengeType | videoUrl | localeTitle |
|---|---|---|---|---|
| 587d7db3367417b2b2512b8f | Match Literal Strings | 1 | المباراة الحرفيه الاوتار |
Description
"Hello" باستخدام التعبير العادي /Hello/ . بحث هذا التعبير المنطقي عن تطابق حرفي لسلسلة "Hello" . إليك مثال آخر يبحث عن مطابقة حرفية لسلسلة "Kevin" : let testStr = "مرحبًا ، اسمي كيفن."؛أي أشكال أخرى من
let testRegex = / Kevin /؛
testRegex.test (testStr)؛
// يعود صحيح
"Kevin" لن تتطابق. على سبيل المثال ، لن يتطابق regex /Kevin/ مع "kevin" أو "KEVIN" . let wrongRegex = / kevin /؛سيظهر تحدٍّ مستقبلي كيفية مضاهاة هذه الأشكال الأخرى أيضًا.
wrongRegex.test (testStr)؛
// إرجاع خاطئة
Instructions
waldoRegex regex للعثور على "Waldo" في السلسلة waldoIsHiding مع مطابقة حرفية. Tests
tests:
- text: يجب أن يجد <code>waldoRegex</code> regex الخاص بك <code>"Waldo"</code>
testString: 'assert(waldoRegex.test(waldoIsHiding), "Your regex <code>waldoRegex</code> should find <code>"Waldo"</code>");'
- text: يجب ألا يبحث regex <code>waldoRegex</code> عن أي شيء آخر.
testString: 'assert(!waldoRegex.test("Somewhere is hiding in this text."), "Your regex <code>waldoRegex</code> should not search for anything else.");'
- text: يجب إجراء مطابقة سلسلة حرفية مع تعبيرك المعتاد.
testString: 'assert(!/\/.*\/i/.test(code), "You should perform a literal string match with your regex.");'
Challenge Seed
let waldoIsHiding = "Somewhere Waldo is hiding in this text.";
let waldoRegex = /search/; // Change this line
let result = waldoRegex.test(waldoIsHiding);
Solution
// solution required