Hey can anyone tell me , why my regex matched successfully in string?

Tell us what’s happening:
Describe your issue in detail here.

Your code so far


let text = "<h1>Winter is coming</h1>";
let myRegex = /<.1>?/; // Change this line
let result = text.match(myRegex);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Find Characters with Lazy Matching

Link to the challenge:

this is the breakdown of the pattern from regex101
image

You are not using lazy matching, but it passes anyway it seems - it’s really difficult to create tests that can evaluate correctly anything that the user can write, so there can be various possible things that passes the tests but still do not match the requirements

you can create a Bug Report if you want

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.