Search code examples
notepad++text-editorediting

How to move character from one line into beggining of another in Notepad++


I have *srt subtitles, and I need to move some characters from one line to the beggining of another.

Example:

aaaaaaaaa w 
aaaaaaaaaaa

And the result should be

aaaaaaaaa
w aaaaaaaaa

Tried

Find what:    w\r
Replace with:  \nw

But that gives me

aaaaaaaaa
w
aaaaaaaaa

What should I do?


Solution

  • I'm not sure whether you intend to only move the trailing character w to the next line, or if other things need to move, but the following find and replace seems to be working in NPP:

    Find:    (.*?) (\w)\R(\S+)
    Replace: $1\n$2 $3
    

    For the input:

    aaaaaaaaa w
    aaaaaaaaaaa
    

    This generated the following output:

    aaaaaaaaa
    w aaaaaaaaaaa