如何删除2个字符之间的文本?


9

例如,我有:

Apple:123456789:pear
watermelon:57952161354:kfc

如何删除“:”之间的文本以获取此信息:

Apple:apple
watermelon:kfc

Answers:


21

如何:用单个替换2 秒之间的所有文本:

  • 菜单“搜索”>“替换”(或Ctrl+ H

  • 将“查找内容”设置为 :.*?:

  • 将“替换为”设置为 :

  • 启用“正则表达式”

  • 点击“全部替换”

图片

之前

Apple:123456789:pear 
watermelon:57952161354:kfc

之后

Apple:pear 
watermelon:kfc

进一步阅读


我会说这:[^:]++:会更有效率-但是只有文本文件很大时,这才真正重要。您也可以尝试用:[^:]++(?=:)空字符串替换-但我不确定记事本是否支持环视。
蜘蛛鲍里斯(Boris the Spider)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.