I know perl style regular expresions fairly well, but today I found one that I do not understand:
preg_match('/^On.+?wrote:.+?$/i',$line); //reduced example
What does the .+?
mean? I undarstand the .+
alone, I understand .?
alone. But .+?
? It seems a bug to me.
The line should match popular citation prefixes in the email body and it is much more complicated along with look behinds, but this is the only part i can't understand, and still the regexp seems to work correclty.