Notepad++ 记事本++;-正则表达式-在匹配行下方插入 查找内容:(\$apple)(?!.\$apple) 替换:\1\n查找

Notepad++ 记事本++;-正则表达式-在匹配行下方插入 查找内容:(\$apple)(?!.\$apple) 替换:\1\n查找,notepad++,Notepad++,鉴于: $apple hello 运行代码后,我希望: $apple hello found 但它不起作用,我得到: $apple found hello Ctrl+H 查找内容:\$apple(?。*\$apple)。*?\R 替换为:$0Found 检查匹配案例 检查环绕 检查正则表达式 检查。匹配换行符 全部替换 说明: \$apple # literally $apple (?!.*\$apple) # make we haven't $apple aft

鉴于:

$apple hello
运行代码后,我希望:

$apple hello
found
但它不起作用,我得到:

$apple 
found hello
  • Ctrl+H
  • 查找内容:
    \$apple(?。*\$apple)。*?\R
  • 替换为:
    $0Found
  • 检查匹配案例
  • 检查环绕
  • 检查正则表达式
  • 检查
    。匹配换行符
  • 全部替换
说明:

\$apple         # literally $apple
(?!.*\$apple)   # make we haven't $apple after
.*?             # 0 or more any character, not greedy
\R              # any kind of linebreak
$0          # the whole match, including linebreak
Found       # literally
更换:

\$apple         # literally $apple
(?!.*\$apple)   # make we haven't $apple after
.*?             # 0 or more any character, not greedy
\R              # any kind of linebreak
$0          # the whole match, including linebreak
Found       # literally
屏幕截图(之前):

\$apple         # literally $apple
(?!.*\$apple)   # make we haven't $apple after
.*?             # 0 or more any character, not greedy
\R              # any kind of linebreak
$0          # the whole match, including linebreak
Found       # literally

屏幕截图(之后):

\$apple         # literally $apple
(?!.*\$apple)   # make we haven't $apple after
.*?             # 0 or more any character, not greedy
\R              # any kind of linebreak
$0          # the whole match, including linebreak
Found       # literally

你是说像这样的
\$apple(?!\$apple)\S+