我的文件内容如下
abcd-12=jksjd-jkkj
xyzm-87=hjahf-tyewg-iuoiurew
zaqw-99=poiuy-12hd-jh-12-kjhk-4rt45
我想在等号的RHS上用下划线符号代替下划线。
No of hypenated terms are variable in the lines, it can be 3 or 4 or 5
如何针对整个文档执行此操作。左侧应完好无损。
我想要的结果是:
abcd-12=jksjd_jkkj
xyzm-87=hjahf_tyewg_iuoiurew
zaqw-99=poiuy_12hd_jh_12_kjhk_4rt45
这将取代任何数量的连字符的单次:
(?:=|(?!^)\G).*?\K-
_
. matches newline
说明:
(?: # non capture group
= # equal sign
| # OR
(?!^) # negative lookahead, make sure we are not at the beginning of a line
\G # restart from last match position
) # end group
.*? # 0 or more any character but newline, not greedy
\K # forget all we have seen until this position
- # a hyphen
屏幕截图(之前):
屏幕截图(之后):
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句