在记事本++中的字符后清除数据

时间:2019-03-06 18:55:58

标签: notepad++

如何清理下面文本的最后一部分以仅检索到.xls的数据?

/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.xls, 247 KB, 06/11/2013

我只需要这一部分/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.xls

我尝试使用下面的命令,但是没有按预期工作。

  

选择正则表达式并环绕。区分大小写

     

查找内容:,[0-9]。*

     

替换为:(保留为空)

2 个答案:

答案 0 :(得分:0)

尝试查找正则表达式xls,.*$并将其替换为xls。您的正则表达式将匹配任何逗号,后跟数字字符,它太宽了。

答案 1 :(得分:0)

  • Ctrl + H
  • 查找内容:\.\S+\K,.+$
  • 替换为:LEAVE EMPTY
  • 检查环绕
  • 检查正则表达式
  • 取消检查. matches newline
  • 全部替换

说明:

\.      # a dot
\S+     # 1 or more non spaces
\K      # forget all we've seen until this position
,       # a comma
.+      # 1 or more any character but newline
$       # end of line

给出:

/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.xls, 247 KB, 06/11/2013
/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.pdf, 247 KB, 06/11/2013
/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.csv, 247 KB, 06/11/2013

给定示例的结果

/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.xls
/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.pdf
/Artifacts & Supporting Docs/AR.01 - WLCE cohort schema Rel 3.0 final Jan, 3, 2013.csv

屏幕截图:

enter image description here