Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是在 perldoc 中找到的示例:
$object->expect(15, '-re', "$str");
我想在比赛中添加选项“i”。这不起作用:
$object->expect(15, '-re', qr/$str/i);
我是否必须使用这种格式:
$exp->expect($timeout, [ qr/$str/i, sub {}], $shell_prompt);
您可以将指令嵌入到正则表达式本身:
$object->expect(15, '-re', "(?i)$str");
参考: http: //perldoc.perl.org/perlre.html#Extended-Patterns