【发布时间】:2020-02-14 17:28:18
【问题描述】:
如何仅在某个锚点之后在字符串中进行替换?
我需要:
xtop.xnext.sig1 --> xtop.xnext-sig1
xtop.xnext.xlower.sig2 --> xtop.xnext-xlower-sig2
在 Perl 中使用优雅的 s///。有没有一种很酷的方法可以使用xtop.xnext 作为锚点(即所有'.' --> '-' 但仅在xtop.xnext 之后)而不是首先匹配然后使用多个命令拼接?
【问题讨论】:
标签: regex perl substitution