Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using RegEX To Prefix And Append In Notepad++

I have quite a large list of words in a txt file and I'm trying to do a regex find and replace in Notepad++. I need to add a string before each line and after each line.. So that:

 wordone wordtwo wordthree 

become

 able:"wordone" able:"wordtwo" able:"wordthree" 

How can I do this?

like image 866
zuk1 Avatar asked Nov 12 '08 10:11

zuk1


People also ask

Can I use regex in Notepad?

Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.

What regex does Notepad ++ use?

FYI Notepad++ supports “PCRE” (i.e. PERL Compatible Regular Expressions) using Boost's RegEx library which is different from the PCRE and PCRE2 libraries.


1 Answers

Assuming alphanumeric words, you can use:

Search  = ^([A-Za-z0-9]+)$ Replace = able:"\1" 

Or, if you just want to highlight the lines and use "Replace All" & "In Selection" (with the same replace):

Search = ^(.+)$ 

^ points to the start of the line.
$ points to the end of the line.

\1 will be the source match within the parentheses.

like image 98
Jonathan Lonowski Avatar answered Oct 13 '22 21:10

Jonathan Lonowski