如何在 Notepad++ 中排除双引号内的搜索模式 [英] How can I exclude search pattern within double quotes in Notepad++
本文介绍了如何在 Notepad++ 中排除双引号内的搜索模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下行,我想用空格(制表符)替换空格,但希望将空格保留在双引号内.我在使用 Notepad++.
I have the following line from which I want to replace space with whitespace (tab) but want to keep the spaces within the double quotes as it is. I am on Notepad++.
[11/May/2020:10:10:20 -0400] "GET / HTTP/1.1" 302 523 52197 url.com - - TLSv1.2 19922 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" https://somelinkhere - -
所需的输出:
[11/May/2020:10:10:20 -0400] "GET / HTTP/1.1" 302 523 52197 url.com - - TLSv1.2 19922 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" https://somelinkhere - -
通过下面的正则表达式,我能够选择双引号下的字符串,但它对我没有用.
Through the following regex I was able to select the string under the double quotes, but it's of no use for me.
"([^"]*)"
你能帮我实现这个吗?
推荐答案
可以使用
("[^"]*")|[ ]
替换为 (?1$1:\t)
.
详情:
("[^"]*")
- 捕获组 1:一个"
,然后是除" 之外的零个或多个字符
然后是"
|
- 或[ ]
- 匹配一个空格(您可以在此处删除[
和]
,它们用于使空格模式在回答).
("[^"]*")
- Capturing group 1: a"
, then zero or more chars other than"
and then a"
|
- or[ ]
- matches a space (you may remove[
and]
here , they are used to make the space pattern visible in the answer).
查看演示截图:
这篇关于如何在 Notepad++ 中排除双引号内的搜索模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文