Regular expression in regards to question mark “lazy” mode
问题 I understand the ? mark here means "lazy". My question essentially is [0-9]{2}? vs [0-9]{2} Are they same? If so, why are we writing the former expression? Aren't lazy mode more expensive performance wise? If not, can you tell the difference? 回答1: There is not a difference between [0-9]{2} and [0-9]{2}? . The difference between greedy matching and lazy matching (the addition of a ? ) has to do with backtracking. Regular expression engines are built to match text (from left to right).