Quantifiers grab as much as possible by default
By default, all quantifiers are greedy. They consume as many characters as they can, then backtrack only if the rest of the pattern fails to match.
The classic example: pattern a.*b against input a123b456b. Naive expectation: it matches a123b (the first b after a). Reality: it matches a123b456b (everything from the first a to the LAST b).
Why greedy by default
Backtracking. The engine tries to match .* against the entire rest of the string, sees that b doesn't follow (because we're at end of string), then backtracks one character and tries again. It keeps backtracking until it finds a position where the literal b matches — which happens at the LAST b, not the first.
Once you internalize "greedy means longest possible," half of regex's surprises stop being surprises.
The greedy trap
The most common mistake in beginner regex: trying to extract a substring between two markers using .* (which is greedy). It will eat past your intended endpoint to the LAST occurrence of the closing marker.