Find Characters with Lazy Matching question for admin

Find Characters with Lazy Matching question for admin
0.0 0

#1

Tell us what’s happening:
Hello I’m working on the regular expression
and I have done Lazy Matching task
below is my solution and there isn’t any problem


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

But I try also more simple solution and test shows me that I solved it but there isn’t any lazy matching
I just thinking that there is a little bug, because I can do it without any lazy solution

<p>
let myRegex = /<h1>/;
</p>

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/find-characters-with-lazy-matching


#2

This is not a bug. The tests verify if your code is able to solve them. They don’t actually verify your code. That would be quite impossible to do as not everyone writes code in the exact same way. Let me give a simple example:

<h1>Hello World</h1>
vs

<h1>
    Hello World
</h1>

Both codes are perfectly valid and do exactly the same. Yet, they’re written differently. In this example we’re just talking about a few lines of code. But as you progress in the challenges, the solutions require many more lines of code. It would be impossible to “predict” every possible answer a member might give as a solution.