user2930006
user2930006

Reputation: 233

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!

Upvotes: 0

Views: 140

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627469

You may use

Find What: ^\w+$
Replace With: '1' NULL, 'test' '$0', 'reg'

See the regex demo

enter image description here

Upvotes: 1

Related Questions