简体   繁体   English

正则表达式以查找单词并用记事本++中包含该单词的行替换

[英]Regex to find a word and replace with a line containing the word in notepad++

I have a text file where each line is a word. 我有一个文本文件,其中每一行都是一个单词。

Abc_123
Def_345

I want to replace each line such as the word is inserted in the middle like this: 我想替换每一行,例如将单词插入中间,如下所示:

'1' NULL, 'test' 'Abc_123', 'reg'
'1' NULL, 'test' 'Def_345', 'reg' 

I know ^ and $ can be used to insert at the start and beginning. 我知道^和$可用于在开头和开头插入。 But how do I insert in the middle ? 但是,如何在中间插入? Would appreciate any help. 将不胜感激。

Thanks! 谢谢!

You may use 您可以使用

Find What : ^\\w+$ 查找内容^\\w+$
Replace With : '1' NULL, 'test' '$0', 'reg' 替换为'1' NULL, 'test' '$0', 'reg'

See the regex demo 正则表达式演示

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM