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

16 lines
541 B
Markdown
Raw Normal View History

---
title: Find Characters with Lazy Matching
localeTitle: العثور على شخصيات مع مطابقة كسول
---
## العثور على شخصيات مع مطابقة كسول
#### تحدي دبي:
أصلح regex `/<.*>/` لإرجاع علامة HTML `<h1>` وليس النص `<h1>Winter is coming</h1>` . تذكر حرف البدل. في التعبير العادي يطابق أي حرف.
#### حل:
`let text = "<h1>Winter is coming</h1>";
let myRegex = /<h1>?/; // it's the answer!
let result = text.match(myRegex);
`