An answer from another question piqued my curiosity.
Consider:
$string = "asfasdfasdfasdfasdf[[sometextomatch]]asfkjasdfjaskldfj";
$regex = "/\[\[(.+?)\]\]/";
preg_match($regex, $string, $matches);
$regex = "/\[\[(.*)\]\]/";
preg_match($regex, $string, $matches);
I asked what the difference between the two regexes is. The aswer I got was that ".*" matches any character 0 or more times as many times as possible, and ".+?" matches any character 1 or more times as few times as possible.
I read those regexes differently so I did some experimenting on my own but didn't come to any conclusions. Php.net says "?" is equivalent to {0,1} so you could rewrite
"/\[\[(.+?)\]\]/"
as
"/\[\[((.+){0,1})\]\]/"
or as
"/\[\[(.{0,})\]\]/"
or as
"/\[\[(.*)\]\]/"
Will they capture different text? Is the difference that one is less expensive? Am I being anal?