![Sublime regex 替换单词开头的特定字符](https://linux22.com/image/1602900/Sublime%20regex%20%E6%9B%BF%E6%8D%A2%E5%8D%95%E8%AF%8D%E5%BC%80%E5%A4%B4%E7%9A%84%E7%89%B9%E5%AE%9A%E5%AD%97%E7%AC%A6.png)
我正在尝试删除角色否从每个多个单词开始。如果你检查下面的行,你会注意到一些单词也有字符否。
例如更改N'KISWAJKN'
为'KISWAJKN'
(2019, N'0081', N'KISWAJKN', N'0001', N'EVELYNE', 12, N'F', N'205', N'GA', N'2019_0081_0001.png')
替换完成后,上面那行看起来应该像这样:
(2019, '0081', 'KISWAJKN', '0001', 'EVELYNE', 12, 'F', '205', 'GA', '2019_0081_0001.png');
另外,如果可能的话,每行都用分号结尾
答案1
- Ctrl+H
- 寻找:
,\h*\KN(?=')
- 代替:
LEAVE EMPTY
- Replace all
解释:
, # a comma
\h* # 0 or more horizonal spaces
\K # forget all we have seen until this position
N # letter N
(?= # start lookahead, make sure we have after:
' # a single quote
) #end lookahead
给定示例的结果:
(2019, '0081', 'KISWAJKN', '0001', 'EVELYNE', 12, 'F', '205', 'GA', '2019_0081_0001.png')
屏幕截图: