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.
在 Perl 中使用正则表达式过滤所有包含例如的行的最佳方法是什么/usr/libexec/postfix?
/usr/libexec/postfix
这也会捕获,例如:/usr/libexec/postfix/qmgr, /usr/libexec/postfix/smtp,/usr/libexec/postfix/local等等?
/usr/libexec/postfix/qmgr
/usr/libexec/postfix/smtp
/usr/libexec/postfix/local
这应该有效:
if ($line =~ m{^/usr/libexec/postfix.*}) { print "Match!\n"; } else { print "No match\n"; }
工作示例: http ://codepad.org/jkVlISdv