--- id: 587d7db4367417b2b2512b90 title: Match a Literal String with Different Possibilities challengeType: 1 videoUrl: '' localeTitle: تطابق سلسلة حرفية مع الاحتمالات المختلفة --- ## Description
باستخدام regexes مثل /coding/ ، يمكنك البحث عن نمط "coding" في سلسلة أخرى. يعد هذا أمرًا قويًا للبحث عن سلاسل مفردة ، ولكنه يقتصر على نمط واحد فقط. يمكنك البحث عن أنماط متعددة باستخدام alternation أو OR المشغل: | . هذا المشغل يطابق الأنماط قبل أو بعدها. على سبيل المثال ، إذا كنت تريد مطابقة "yes" أو "no" ، فإن التعبير المعتاد الذي تريده هو /yes|no/ . يمكنك أيضًا البحث عن أكثر من نمطين فقط. يمكنك القيام بذلك عن طريق إضافة المزيد من الأنماط مع المزيد من عوامل تشغيل OR تفصل بينها ، مثل /yes|no|maybe/ .
## Instructions
أكمل petRegex regex petRegex مع الحيوانات الأليفة "dog" أو "cat" أو "bird" أو "fish" .
## Tests
```yml tests: - text: يجب إرجاع petRegex الخاص بك regex true للسلسلة "John has a pet dog." testString: 'assert(petRegex.test("John has a pet dog."), "Your regex petRegex should return true for the string "John has a pet dog."");' - text: يجب إرجاع petRegex الخاص بك regex false لسلسلة "Emma has a pet rock." testString: 'assert(!petRegex.test("Emma has a pet rock."), "Your regex petRegex should return false for the string "Emma has a pet rock."");' - text: يجب إرجاع petRegex الخاص بك regex true للسلسلة "Emma has a pet bird." testString: 'assert(petRegex.test("Emma has a pet bird."), "Your regex petRegex should return true for the string "Emma has a pet bird."");' - text: يجب إعادة petRegex الخاص بك regex true للسلسلة "Liz has a pet cat." testString: 'assert(petRegex.test("Liz has a pet cat."), "Your regex petRegex should return true for the string "Liz has a pet cat."");' - text: يجب إعادة petRegex الخاص بك regex false للسلسلة "Kara has a pet dolphin." petRegex "Kara has a pet dolphin." testString: 'assert(!petRegex.test("Kara has a pet dolphin."), "Your regex petRegex should return false for the string "Kara has a pet dolphin."");' - text: يجب أن يعود petRegex المعتاد الخاص بك true للسلسلة "Alice has a pet fish." testString: 'assert(petRegex.test("Alice has a pet fish."), "Your regex petRegex should return true for the string "Alice has a pet fish."");' - text: يجب أن petRegex المعتاد الخاص بك false للسلسلة "Jimmy has a pet computer." testString: 'assert(!petRegex.test("Jimmy has a pet computer."), "Your regex petRegex should return false for the string "Jimmy has a pet computer."");' ```
## Challenge Seed
```js let petString = "James has a pet cat."; let petRegex = /change/; // Change this line let result = petRegex.test(petString); ```
## Solution
```js // solution required ```