【发布时间】:2017-06-19 14:36:29
【问题描述】:
我有以下正则表达式:
perl -pi -w -e "s/(\bgetnitemc)\(([^,]+),([^,]+)\)/\$1\(\$2,\$3,1,1,''\)/g;" d_*.sas
影响如下(git diff):
- if getnitemc(l_sub2,'OBJTYPE') = 'SLIST' then
- l_tempa = insertc(l_tempa,getnitemc(l_sub2,'OBJNAME'));
+ if getnitemc(l_sub2,'OBJTYPE',1,1,'') = 'SLIST' then
+ l_tempa = insertc(l_tempa,getnitemc(l_sub2,'OBJNAME'),1,1,'');
因此,第一行的行为按预期工作。但是,在第二行中,我尝试添加的部分 (,1,1,'') 应用于包装函数 (insertc) 而不是目标函数 (getnitemc)。如果你能明白我的意思,它有点“跳过括号”。
我哪里错了?
【问题讨论】: