let testStr = "Repeat، Repeat، Repeat"؛للبحث أو استخراج نمط أكثر من مرة ، يمكنك استخدام علم
دع ourRegex = / كرر /؛
testStr.match (ourRegex)؛
// Returns ["Repeat"]
g . اترك repeatRegex = / Repeat / g؛
testStr.match (repeatRegex)؛
// Returns ["Repeat"، "Repeat"، "Repeat"]
starRegex ، ابحث starRegex الكلمات "Twinkle" من سلسلة twinkleStar . ملحوظة /search/gi starRegex regex الخاص بك العلم العالمي g
testString: 'assert(starRegex.flags.match(/g/).length == 1, "Your regex starRegex should use the global flag g");'
- text: يجب أن يستخدم starRegex الخاص بك regex starRegex الحالة غير الحساسة i
testString: 'assert(starRegex.flags.match(/i/).length == 1, "Your regex starRegex should use the case insensitive flag i");'
- text: يجب أن تتطابق المطابقة مع كلمتين لكلمة "Twinkle"
testString: 'assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), "Your match should match both occurrences of the word "Twinkle"");'
- text: يجب أن تحتوي result المطابقة الخاصة بك على عنصرين.
testString: 'assert(result.length == 2, "Your match result should have two elements in it.");'
```