0

我刚刚在正则表达式中学习了前瞻,但是有一个细节困扰着我:

% set test abcdehehfkdehemno

% regexp {([^ ])*.} $test match

1

% set match

abcdehehfkdehemno

% regexp {((?=dehe).)*.} $test match

1

% set match

a

为什么([^ ])*是贪婪而((?=dehe).)*不是,我希望前瞻版本返回 m 而不是 a ?

4

0 回答 0