简体   繁体   English

从Notepad ++中删除行中的所有数字+符号

[英]Remove all numbers + symbols from line in Notepad++

Is it possible to remove every line in a notepad++ Not Containing 是否可以删除记事本中的每一行++ Not Containing

a   b   c   d   e   f   g   h   i   j   k   l   m
n   o   p   q   r   s   t   u   v   w   x   y   z

A   B   C   D   E   F   G   H   I   J   K   L   M
N   O   P   Q   R   S   T   U   V   W   X   Y   Z

,   .   '

Like that : 像那样 :

在此输入图像描述

Remove Non-ascii 删除非ascii

.*[^\x00-\x7F]+.*

Remove Numbers 删除数字

.*[0-9]+.*

Text : 文字:

example
example'
example,
example.


example123
éxample è
[example/+
example'/é,
example,*
exa'mple--
example@
example"

You may use 你可以用

^(?![a-zA-Z,.']+$).+$\R?

The regex matches any non-empty line ( .+ ) that does not only consist of ASCII letters, , , . 正则表达式匹配任何非空行( .+ ),它不仅由ASCII字母, ,. or ' . 或者' \\R? at the end matches an optional line break. 最后匹配一个可选的换行符。

Details : 细节

  • ^ - start of a string ^ - 字符串的开头
  • (?![a-zA-Z,.']+$) - a negative lookahead that fails the match if its pattern is not matched: [a-zA-Z,.']+ - 1 or more ASCII letters, comma, period or single quote up to the end of the line ( $ ) (?![a-zA-Z,.']+$) - 如果匹配模式不匹配则导致匹配失败: [a-zA-Z,.']+ - 1个或多个ASCII字母,逗号,期限或单一报价直到行尾( $
  • .+ - 1+ chars other than line break char .+ - 除了换行符之外的1 +个字符
  • $ - end of a line $ - 结束一行
  • \\R? - an optional line break char (sequence) - 可选的换行符(序列)

在此输入图像描述

You can remove them like this: 您可以像这样删除它们:

Find what: ^.*[^a-zA-Z.,'].*$ 找到: ^.*[^a-zA-Z.,'].*$
Replace with: `` 替换为:``

Explanation: 说明:

  • .* for any text .*任何文字
  • the negated character class [^...] for any unwanted character 任何不需要的字符的否定字符类[^...]
  • then again .* for more any text 再一次.*更多任何文字
  • You need to wrap it into ^...$ to match the whole line 你需要将它包装成^...$以匹配整行

If you want to delete the linefeed characters, then you can use \\r?\\n instead of the $ sign. 如果要删除换行符,则可以使用\\r?\\n而不是$符号。 Ie: ^.*[^a-zA-Z.,'].*\\r?\\n 即: ^.*[^a-zA-Z.,'].*\\r?\\n

尝试替换所有这些匹配

^.+?[^a-zA-Z,.'\r\n]+(.|\r?\n)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM