[Solved] Problem with regex match in javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[Solved] Problem with regex match in javascript

In my prgram, there are 4 matches of given pattern, but it returns only 3, and when I break the last line to new line, it'll 4 matches. what is the reason and solution for this. https://code.sololearn.com/Wt2pnrzwfyR5/?ref=app

3rd Sep 2020, 3:34 PM
Bibek Oli
Bibek Oli - avatar
1 Answer
+ 3
Greedy and lazy quantifiers https://javascript.info/regexp-greedy-and-lazy It has the solution and the reason. And the site overall is excellent Javascript reference https://code.sololearn.com/WbA401yACUKa/#html
3rd Sep 2020, 5:19 PM
ODLNT
ODLNT - avatar