Backtracking is a general algorithm for finding solutions to some computational problem, that incrementally builds candidates to the solutions.
A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum.
|Steps much fewer||
"Since the next is not far the number of backtracking steps is much fewer than with greedy matching"
from question "Can I improve performance of this regular expression further"
"The capturing group 1 in the first pattern is greedy it first matches everything and takes as less as it backtracking"
from question "Confusion in RegExp Reluctant quantifier? Java"