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

18 lines
526 B
Markdown
Raw Normal View History

---
title: Find Characters with Lazy Matching
localeTitle: Encontrar personagens com correspondência preguiçosa
---
## Encontrar personagens com correspondência preguiçosa
#### Desafio:
Corrija o regex `/<.*>/` para retornar a tag HTML `<h1>` e não o texto `<h1>Winter is coming</h1>` . Lembre-se do curinga. em uma expressão regular corresponde a qualquer caractere.
#### Solução:
```js
let text = "<h1>Winter is coming</h1>";
let myRegex = /<h1>?/; // it's the answer!
let result = text.match(myRegex);
```