This is not a greedy match. In the [AB]*?regular expression, it searches for as few entries as possible [AB]so that the general match of the regular expressions matches the search string, while the greedy version [AB]*looks through as many cases as possible. This is a feature of Perl regexes and is therefore available in PCRE (Perl Compatible Regular Expressions) (see repetition ) and other systems that look at Perl to define them.
The PCRE page provides an example:
, [] , C. /* */, * /. C :
/\*.*\*/
not comment
, - .*.
, ,
/\*.*?\*/
C.