在perl中删除正则表达式中的单词

时间:2014-12-04 08:52:18

标签: regex perl

我有一个字符串,其值可以是

my $str = "auth_plugin_stack = a,b,EXT::USCC::USCCAuth,c,d"; # should return auth_plugin_stack = a,b,c,d

我希望有一个正则表达式来删除“EXT :: USCC :: USCCAuth'”这个词。

$ str也可以有以下值。

my $str = "auth_plugin_stack = EXT::USCC::USCCAuth"; # should return auth_plugin_stack = 
my $str = "auth_plugin_stack = a,b,EXT::USCC::USCCAuth"; # should return auth_plugin_stack = a,b
my $str = "auth_plugin_stack = EXT::USCC::USCCAuth,c,d"; # should return auth_plugin_stack = c,d

感谢。

1 个答案:

答案 0 :(得分:0)

EXT::USCC::USCCAuth,?|,?EXT::USCC::USCCAuth

试试这个。empty string。见。演示。

http://regex101.com/r/yR3mM3/42