Search code examples
notepad++reverse

switch place of a sentence to another sentence without changing a specific word place on notepad++


i've searched alot for that but i couldn't find, switch place of a sentence to another sentence without changing a specific word place on notepad++

That means i want to change:

hello:imawesome | yes:imawesome | ohyeah:awesomevibes

i want to change it to:

imawesome:hello | imawesome:yes | awesomevibes:ohyeah

i hope you got what i mean i don't want to change the ":" place i just want to switch the texts places without doing any change in the ":"

on notepad++

i hope i find an answer.


Solution

  • To do this you can make use of ([\S]+) to find individual words, and simply seperate them by the colan : like so:

    ([\S]+):([\S]+)

    And in the replace box just insert the following to reverse the order:

    \2:\1

    For input of:

    hello:imawesome | yes:imawesome | ohyeah:awesomevibes

    The result of replacing all instances is:

    imawesome:hello | imawesome:yes | awesomevibes:ohyeah

    Just make sure that the Regular expression option is ticked: enter image description here