freeCodeCamp/guide/russian/certifications/javascript-algorithms-and-d.../regular-expressions/find-characters-with-lazy-m.../index.md

18 lines
649 B
Markdown
Raw Normal View History

2018-10-12 20:00:59 +00:00
---
title: Find Characters with Lazy Matching
localeTitle: Найти персонажей с ленивым соответствием
---
## Найти персонажей с ленивым соответствием
#### Challange:
Исправьте regex `/<.*>/` чтобы вернуть HTML-тег `<h1>` а не текст `<h1>Winter is coming</h1>` . Помните шаблон. в регулярном выражении соответствует любому символу.
#### Решение:
```js
let text = "<h1>Winter is coming</h1>";
let myRegex = /<h1>?/; // it's the answer!
let result = text.match(myRegex);
```