--- id: 587d7db5367417b2b2512b94 title: Match Anything with Wildcard Period challengeType: 1 videoUrl: '' localeTitle: تطابق أي شيء مع فترة أحرف البدل --- ## Description
في بعض الأحيان ، لن (أو لا تحتاج إلى) معرفة الأحرف الدقيقة في أنماطك. التفكير في كل الكلمات التي تتطابق مع ، على سبيل المثال ، خطأ إملائي سيستغرق وقتًا طويلاً. لحسن الحظ، يمكنك توفير الوقت باستخدام حرف بدل: . حرف البدل . سوف تطابق أي حرف واحد. ويطلق على حرف البدل أيضا dot period . يمكنك استخدام حرف البدل تمامًا مثل أي حرف آخر في regex. على سبيل المثال ، إذا أردت مطابقة "hug" و "huh" و "hut" و "hum" ، فيمكنك استخدام regex /hu./ لمطابقة كل الكلمات الأربع.
لندع humStr = "سوف ألعب أغنية" ؛
let hugStr = "Bear hug"؛
let huRegex = /hu./؛
humStr.match (huRegex)؛ // Returns ["hum"]
hugStr.match (huRegex)؛ // Returns ["hug"]
## Instructions
أكمل regex unRegex بحيث يتطابق مع السلاسل "run" و "sun" و "fun" و "pun" و "nun" و "bun" . يجب أن يستخدم تعبيرك العادي حرف حرف البدل.
## Tests
```yml tests: - text: يجب عليك استخدام طريقة .test() . testString: 'assert(code.match(/\.test\(.*\)/), "You should use the .test() method.");' - text: يجب عليك استخدام حرف البدل في regex unRegex testString: 'assert(/\./.test(unRegex.source), "You should use the wildcard character in your regex unRegex");' - text: يجب أن يطابق regex unRegex "run" في "Let us go on a run." testString: 'assert(unRegex.test("Let us go on a run."), "Your regex unRegex should match "run" in "Let us go on a run."");' - text: يجب أن يتطابق unRegex regex unRegex مع كلمة "sun" في "The sun is out today." testString: 'assert(unRegex.test("The sun is out today."), "Your regex unRegex should match "sun" in "The sun is out today."");' - text: يجب أن يطابق regex unRegex "fun" في "Coding is a lot of fun." testString: 'assert(unRegex.test("Coding is a lot of fun."), "Your regex unRegex should match "fun" in "Coding is a lot of fun."");' - text: يجب أن يتطابق "pun" regex unRegex مع "pun" في "Seven days without a pun makes one weak." testString: 'assert(unRegex.test("Seven days without a pun makes one weak."), "Your regex unRegex should match "pun" in "Seven days without a pun makes one weak."");' - text: يجب أن يتطابق unRegex regex unRegex مع "nun" في "One takes a vow to be a nun." unRegex "One takes a vow to be a nun." testString: 'assert(unRegex.test("One takes a vow to be a nun."), "Your regex unRegex should match "nun" in "One takes a vow to be a nun."");' - text: يجب أن تتطابق مع regex unRegex "bun" في "She got fired from the hot dog stand for putting her hair in a bun." unRegex "She got fired from the hot dog stand for putting her hair in a bun." testString: 'assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."), "Your regex unRegex should match "bun" in "She got fired from the hot dog stand for putting her hair in a bun."");' - text: يجب ألا يطابق regex unRegex "There is a bug in my code." testString: 'assert(!unRegex.test("There is a bug in my code."), "Your regex unRegex should not match "There is a bug in my code."");' - text: يجب ألا يتطابق التعبير unRegex regex unRegex مع "Catch me if you can." testString: 'assert(!unRegex.test("Can me if you can."), "Your regex unRegex should not match "Catch me if you can."");' ```
## Challenge Seed
```js let exampleStr = "Let's have fun with regular expressions!"; let unRegex = /change/; // Change this line let result = unRegex.test(exampleStr); ```
## Solution
```js // solution required ```