non-greedy pattern of regular expressions.
non-greedy patterns match as few matches as possible.
non-greedy mode is represented by adding one after the number of matches. Number of Matches: * + {m,n}
like a regex = "A *?" ".+?"
in non-greedy mode to make the match as few as possible, as short as possible.
The greedy pattern of regular expressions is as much as possible when matching
such as: <div><p>bdxxx</p></div> <div><p>taaaa</p></div>
greedy pattern Regular expression: regex= "<div>.*</div>"
result: Match once. Obtained for <div><p>bdxxx</p></div> <div><p>taaaa</p></div>
non-greedy pattern regular Expressions: Regex = "<div>.*?</div>"
results: Matched two times. Two times acquired respectively for:<div><p>bdxxx</p></div> and <div><p>taaaa</p></div>
non-greedy mode will match as little as possible, and finish the match the first time you encounter </div>. Make next match
The greedy pattern will be matched as much as possible, and continue to match backwards after the first encounter </div> to find the last </div> to complete the match.