--- id: 587d7db5367417b2b2512b94 title: Match Anything with Wildcard Period challengeType: 1 forumTopicId: 301348 localeTitle: Сопоставить все с подстановочным периодом --- ## Description
Иногда вам не нужно (или не нужно) знать точные символы в ваших шаблонах. Думать обо всех словах, которые совпадают, скажем, с орфографией, займет много времени. К счастью, вы можете сэкономить время , используя подстановочные символы: . Символ подстановки . будет соответствовать любому персонажу. Подстановочный знак также называется dot и period . Вы можете использовать подстановочный знак, как и любой другой символ в регулярном выражении. Например, если вы хотите совместить "hug" , "huh" , "hut" и "hum" , вы можете использовать regex /hu./ для соответствия всем четырем словам.
пусть humStr = «Я буду напевать песню»;
let hugStr = «Обнимать медведя»;
пусть huRegex = /hu./;
humStr.match (huRegex); // Возвращает ["гул"]
hugStr.match (huRegex); // Возвращает ["hug"]
## Instructions
Заполните regex unRegex так, чтобы он соответствовал строкам "run" , "sun" , "fun" , "pun" , "nun" и "bun" . В вашем регулярном выражении должен использоваться символ подстановки.
## Tests
```yml tests: - text: You should use the .test() method. testString: assert(code.match(/\.test\(.*\)/)); - text: You should use the wildcard character in your regex unRegex testString: assert(/\./.test(unRegex.source)); - text: Your regex unRegex should match "run" in "Let us go on a run." testString: assert(unRegex.test("Let us go on a run.")); - text: Your regex unRegex should match "sun" in "The sun is out today." testString: assert(unRegex.test("The sun is out today.")); - text: Your regex unRegex should match "fun" in "Coding is a lot of fun." testString: assert(unRegex.test("Coding is a lot of fun.")); - text: Your regex unRegex should match "pun" in "Seven days without a pun makes one weak." testString: assert(unRegex.test("Seven days without a pun makes one weak.")); - text: Your regex unRegex should match "nun" in "One takes a vow to be a nun." testString: assert(unRegex.test("One takes a vow to be a nun.")); - text: Your regex unRegex should match "bun" in "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.")); - text: Your regex unRegex should not match "There is a bug in my code." testString: assert(!unRegex.test("There is a bug in my code.")); - text: Your regex unRegex should not match "Catch me if you can." testString: assert(!unRegex.test("Can 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 let exampleStr = "Let's have fun with regular expressions!"; let unRegex = /.un/; // Change this line let result = unRegex.test(exampleStr); ```