Regex 跳过这句话;Unmatched(在正则表达式中;在perl中标记为<;--HERE in";error
我必须用新字符串替换文件中的某些字符串Regex 跳过这句话;Unmatched(在正则表达式中;在perl中标记为<;--HERE in";error,regex,perl,Regex,Perl,我必须用新字符串替换文件中的某些字符串 $tobereplaced="SFK_DFKDG_ASDf(SDGFds gfd"; #example string $replace="SFK_DFKDG_ASDf(SDGFds gfd processed"; #example String $value =~ s/$tobereplaced/$replace/g; 在替换时,我遇到了这个错误 不匹配(在正则表达式中;标记为使用\Q元字符禁用搜索字符串中的模式元字符并执行文字字符串替换: $va
$tobereplaced="SFK_DFKDG_ASDf(SDGFds gfd"; #example string
$replace="SFK_DFKDG_ASDf(SDGFds gfd processed"; #example String
$value =~ s/$tobereplaced/$replace/g;
在替换时,我遇到了这个错误
不匹配(在正则表达式中;标记为使用
\Q
元字符禁用搜索字符串中的模式元字符并执行文字字符串替换:
$value =~ s/\Q$tobereplaced/$replace/g;
可以找到更多信息