如何在记事本++中复制标记的文本 [英] How to copy marked text in notepad++
问题描述
我有一部分 HTML 源文件,其中包含我想使用 Notepad++ 的正则表达式功能一次选择和复制的字符串.
I have a part of HTML source file that contains strings that I want to select and copy at once, using the regex functionality of Notepad++.
以下是部分文字来源:
<option value="Performance"
>Performance</option>
<option value="Maintenance"
>Maintenance</option>
<option value="System Stability"
>System Stability</option>
我正在使用正则表达式 "[0-9a-zA-Z ]*"
来搜索值"值.我还选择了 Notepad++ 搜索中的功能来突出显示/标记找到的文本.这工作正常我现在只想将突出显示的文本复制或剪切到剪贴板以进行进一步处理.但是我在 Notepad++ 中找不到这个功能.这是不可能的还是我太笨了?
I'm using the regex "[0-9a-zA-Z ]*"
to search the "value" values. I have also selected the feature in Notepad++ search to highlight/mark the found text. This working fine I now want to copy or cut only the highlighted text to clipboard for further processing. But I'm not able to find this functionality in Notepad++. Is this simply not possible or am I too dumb?
推荐答案
试试这个:
首先修复行尾问题:(Notepad++ 不允许多行正则表达式)
First, fix the line ending problem: (Notepad++ doesn't allow multi-line regular expressions)
搜索[扩展模式]: \r\n>
(或者你自己系统的行尾)
Search [Extended Mode]: \r\n>
(Or your own system's line endings)
替换: >
然后
搜索[正则表达式模式]:
(如果您想要所有出现的 value
而不仅仅是选项,只需删除前导的 option
)
(if you want all occurences of value
rather than just the options, simple remove the leading option
)
替换: \1
第二个正则表达式的解释:
Explanation of the second regular expression:
<option[^>]+ Find a < followed by "option" followed by
at least one character which is not a >
value=" Find the string value="
([^"]+) Find one or more characters which are not a " and save them
to group \1
"[^>]*>.* Find a " followed by zero or more non-'>' characters
followed by a > followed by zero or more characters.
是的,它使用正则表达式解析 HTML -- 这些警告适用 - 仔细检查输出.
Yes, it's parsing HTML with a regex -- these warnings apply -- check the output carefully.
这篇关于如何在记事本++中复制标记的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!