Beerenmix
Beerenmix

Reputation: 13

Notepad ++ Reg Exp - Move end of line to beginning of line

I am trying to swap the content beginning from the hyphen in each line to the start of each line. I can find the hyphen with (-.*) But I don't know the regexp for the "Replace with:"

Example of how the code looks right now:

Beet - ½ cup
Strawberry - ½ cup
Mango - ½ cup

Desired Outcome:

- ½ cup Beet 
- ½ cup Strawberry
- ½ cup Mango

I appreciate your help. Thanks in advance.

Upvotes: 1

Views: 78

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174696

Find what:

^(\S+)\s+(-.*)

OR

^([^-]*)\s+(-.*)

Replace With:

\2 \1

DEMO

Upvotes: 1

Related Questions