Perl字符串替换问题

时间:2015-07-21 23:36:53

标签: regex string perl replace double-quotes

我有一个字符串,如下所示,

$str = 'dev-phase-to-improve == "NOTEQUAL"'

我想替换:

dev-phase-to-improve == "NOTEQUAL"  

!dev-phase-to-improve=""

想知道我怎么能这样做,我的代码就像下面所示,

$rc_link =~ s/'dev-phase-to-improve == "NOTEQUAL"/!dev-phase-to-improve=""/ig;

但它不起作用。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

它正在运作,请查看

my $str = 'dev-phase-to-improve == "NOTEQUAL"';
$str=~ s/dev-phase-to-improve == "NOTEQUAL"/\!dev-phase-to-improve=""/g;
print $str."\n";