记事本++中包含符号的单词前的新行

New line before a word containg a symbol in notepad ++

我在多行文本中看到包含“)”符号的文字。我想在每个带有“)”的单词之前创建一个新行。

例如我得到:


citrix) 1820193 youtrix) 18337 allow) 29318
gone) 89 lise) 192 top) 192

我想做成这样:

citrix) 1820193
youtrix) 18337
allow) 29318
gone) 89
lise) 192
top) 192

Ctrl+H 打开“替换”对话框。

Search Mode,selectRegular expression.

Find what:中输入(\d)\h

Replace with:中输入\n

命中Replace All

PS。这仅在列表为数字时才有效。如果您想对一些非数字列表执行此操作,则必须在 Find what:.

中输入 ([^\)])\h

祝你好运!

  • Ctrl+H
  • 查找内容:\h+(?=\w+\))
  • 根据您的需要替换为:\n\r\n
  • 选中环绕
  • 检查正则表达式
  • 全部替换

解释:

\h+         : 1 or more horizontal spaces
(?=         : start lookahead, make sure we have after
    \w+     : 1 or more word character. You may use \S+ if have other characters than word character.
    \)      : a closing parenthesis
)           : end lookahead

替换:

\n          : linefeed (you may use \r\n depending on your needs)

给定示例的结果:

citrix) 1820193
youtrix) 18337
allow) 29318
gone) 89
lise) 192
top) 192