For a regular expression to match, the entire regular expression must match, not just part of it. So if the beginning of a pattern containing a quantifier succeeds in a way that causes later parts in the pattern to fail, the matching engine backs up and recalculates the beginning part-that's why it's called backtracking.
Food is on the foo table.
Sometimes minimal matching can help a lot. The food is under the bar in the barn. That's because . That won't work at all, because . As you see, this can be a bit tricky.