Notepad++ 需要将空格/制表符/换行符替换为一些字符,如'';在记事本中++;

Notepad++ 需要将空格/制表符/换行符替换为一些字符,如'';在记事本中++;,notepad++,Notepad++,我有一个像下面这样的文件 10039 10306 10307 10308 10730 10731 10737 10738 10739 我需要在Notepad++中替换它,如下所示,作为SQL代码使用 10039','10306','10307','10308','10730','10731','10737' Ctrl+H 查找内容:(\d+)((\R)|\z) 替换为:“$1”(?2,:) 检查环绕 检查正则表达式 全部替换 说明: (\d+) # group 1, 1 or

我有一个像下面这样的文件

10039
10306
10307
10308
10730
10731
10737
10738
10739
我需要在Notepad++中替换它,如下所示,作为SQL代码使用

10039','10306','10307','10308','10730','10731','10737'
  • Ctrl+H
  • 查找内容:
    (\d+)((\R)|\z)
  • 替换为:
    “$1”(?2,:)
  • 检查环绕
  • 检查正则表达式
  • 全部替换
说明:

(\d+)       # group 1, 1 or more digits
(?:         # non capture group
    (\R)    # group 2, any kind of linebreak
  |         # OR
    \z      # end of file
)           # end group
'$1'        # content of group 1, with single quotes around
(?2         # if group 2  exists
    ,       # a comma
    :       # else
            # nothing
)           # endif
'10039','10306','10307','10308','10730','10731','10737','10738','10739'
更换:

(\d+)       # group 1, 1 or more digits
(?:         # non capture group
    (\R)    # group 2, any kind of linebreak
  |         # OR
    \z      # end of file
)           # end group
'$1'        # content of group 1, with single quotes around
(?2         # if group 2  exists
    ,       # a comma
    :       # else
            # nothing
)           # endif
'10039','10306','10307','10308','10730','10731','10737','10738','10739'
给定示例的结果:

(\d+)       # group 1, 1 or more digits
(?:         # non capture group
    (\R)    # group 2, any kind of linebreak
  |         # OR
    \z      # end of file
)           # end group
'$1'        # content of group 1, with single quotes around
(?2         # if group 2  exists
    ,       # a comma
    :       # else
            # nothing
)           # endif
'10039','10306','10307','10308','10730','10731','10737','10738','10739'
屏幕截图:

(\d+)       # group 1, 1 or more digits
(?:         # non capture group
    (\R)    # group 2, any kind of linebreak
  |         # OR
    \z      # end of file
)           # end group
'$1'        # content of group 1, with single quotes around
(?2         # if group 2  exists
    ,       # a comma
    :       # else
            # nothing
)           # endif
'10039','10306','10307','10308','10730','10731','10737','10738','10739'

该文件是以行skip 10039 10306 10307 10308 10730 10731 10737 10738分隔的实际数字,谢谢,但我已经使用简单的函数解决了以下问题:1.编辑/空白操作/删除不必要的空白和下线2.搜索/替换“纯制表符空间”无论你需要什么样的性格insert@jean:很好,但我想知道如何在开始和结束时仅使用这两个操作就获得一个报价。你应该回答你自己的问题,向人们展示你是如何解决这个问题的;第一部分是菜单中的简单功能(1.编辑/空白操作/删除不必要的空白和下线),第二部分也是菜单中的简单“替换”功能(2.用“,”搜索/替换空白)。实际上,空白/tab/空格被以下“,”@jean:我明白了,但这并不是在字符串的开头和结尾添加引号。