Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy vs Greedy regex not explained #16

Open
0phoff opened this issue Jun 1, 2017 · 0 comments
Open

Lazy vs Greedy regex not explained #16

0phoff opened this issue Jun 1, 2017 · 0 comments

Comments

@0phoff
Copy link

0phoff commented Jun 1, 2017

Hey,

First of all, nice workshopper! It is really concise and straight forward!
The only thing that is not explained well imo, is greedy vs lazy expressions.

Exercise 13: Quotes

Here you hint at the problem and solve it by having a negative group ( [^"]* ).
Maybe a little paragraph explaining the default greedy nature of regular expressions would be nice!
(dont give away the solution, just explain that a regex will try to match as many characters as it can!)

Exercise 14: Blink

In this exercise, you should explain there is a way to make regular expressions lazy and match as few characters as possible! (+?, *?, ??)
The only way I was able to solve this problem, is because I know regular expressions from other languages (and use vim as my main editor.. 🤡). I knew this behaviour and googled how to achieve it in JS, but people who are less familiar with regex might not know this!

Anyway, I really liked this course and it was a good refresher on regular expressions and how they work/behave in JS!

Thanks a lot for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant