我有一个包含数千行包含逗号分隔列的文件。
'one',2,'three','hello','xyz',5,'hello','mnr','hello','axi'
'onae',2,'tree','hello','xyz',6,'hello','mnr','hello','asd'
'onee',2,'xdsa','hello','xyz',5,'hello','mnr','hello','aew'
'owne',2,'thr','hello','xyz',3,'hello','mnr','hello','az'
'ocne',2,'tee','hello','xyz',5,'hello','mnr','hello','zse'
'owne',2,'tre','hello','xyz',2,'hello','mnr','hello','aai'
每行中的三列包含值为“' hello'”。
如何更换第二次出现的单词' hello'使用Textpad中的正则表达式在每一行中使用数字0,使得行变为:
'one',2,'three','hello','xyz',5,0,'mnr','hello','axi'
'onae',2,'tree','hello','xyz',6,0,'mnr','hello','asd'
'onee',2,'xdsa','hello','xyz',5,0,'mnr','hello','aew'
'owne',2,'thr','hello','xyz',3,0,'mnr','hello','az'
'ocne',2,'tee','hello','xyz',5,0,'mnr','hello','zse'
'owne',2,'tre','hello','xyz',2,0,'mnr','hello','aai'
答案 0 :(得分:1)
答案 1 :(得分:0)
我投了anubhava的解决方案,因为这让我非常接近解决方案。
找到这个:
^(.*?'hello'.*?),'hello',
替换为:
$1,0,