Regular Expressions Problem | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 18

Regular Expressions Problem

https://code.sololearn.com/WYEWZ5P0Sr79/?ref=app Plz tell how ? is used for two different purposes First for lazy matching Second for the existence of letter How ? Behaves differently?

20th May 2020, 11:33 PM
Saad Mughal
Saad Mughal - avatar
7 Antworten
+ 24
This is a great question. Thanks for sharing. Even I got confused a little ­čśâ https://javascript.info/regexp-greedy-and-lazy But going through this awesome article the purpose of '?' as lazy quantifier became crystal clear ­čĹî This article explains very clearly how the use '?' after other identifiers like '* 'or in your case '+' makes it lazy and hence able to find multiple matches. I am off to my favorite regex playground to play with this myself. https://regex101.com/
7th Aug 2020, 6:20 PM
Morpheus
Morpheus - avatar
+ 7
Morpheus ­čśä thanks
7th Aug 2020, 6:48 PM
Saad Mughal
Saad Mughal - avatar
21st May 2020, 10:31 AM
Saad Mughal
Saad Mughal - avatar
7th Aug 2020, 6:06 PM
JaScript
JaScript - avatar
+ 3
Bartas Dausynas yes when I done solving algorithm problem with many If else, loops and many lines of code and then see other solutions they solve the same problem with just one line of regex.
8th Aug 2020, 9:23 AM
Saad Mughal
Saad Mughal - avatar
- 2
What is the answer
8th Aug 2020, 4:35 PM
Simrat Kaur
- 2
Said
8th Aug 2020, 4:35 PM
Simrat Kaur