Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace blank space with new line? in notepad++ regex

I have a list of some data which is in this format for example

word1 word2 word3

word4 word5

word6 word7 word8 word9

but I want to split it all up so that each word is in new line so it would become like:

word1

word2

word3

word4

word5

word6

word7

word8

word9

the blank space between the words is perfect seperator which could be used in search&replace but Not sure of what would the code be in notepad++ regex search?

Thanks

like image 870
Rover Pow Avatar asked Apr 21 '16 23:04

Rover Pow


People also ask

How do you replace a blank in notepad?

Click Search and then Replace. In the Replace window, in the Find what section, type ^\n (caret, backslash 'n') and leave the Replace with section blank, unless you want to replace a blank line with other text.

How do you replace 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.


1 Answers

Entering \s+ on the Find what field and \n (Change to \n\n for two new lines) on the Replace With field followed by Replace All transforms:

word1 word2 word3

word4 word5

word6 word7 word8 word9

onto:

word1
word2
word3
word4
word5
word6
word7
word8
word9
like image 191
ᴘᴀɴᴀʏɪᴏᴛɪs Avatar answered Oct 16 '22 07:10

ᴘᴀɴᴀʏɪᴏᴛɪs