What are these two terms in an understandable way?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Greedy will consume as much as possible. From http://www.regular-expressions.info/repeat.html we see the example of trying to match HTML tags with
<.+>. Suppose you have the following:You may think that
<.+>(.means any non newline character and+means one or more) would only match the<em>and the</em>, when in reality it will be very greedy, and go from the first<to the last>. This means it will match<em>Hello World</em>instead of what you wanted.Making it lazy (
<.+?>) will prevent this. By adding the?after the+, we tell it to repeat as few times as possible, so the first>it comes across, is where we want to stop the matching.I’d encourage you to download RegExr, a great tool that will help you explore Regular Expressions – I use it all the time.