Q:

Regex - How can I swap two expressions in different lines? 

I'm pretty new in Regex, but I want to swap two expressions in two different lines. 
Here's the code:
translate italian ch1_a20cefa7:|

# "..."
msgstr "..."

I'd like to swap in:
translate italian ch1_a20cefa7:msgstr

# "..."
| "..."

As you can see, the | has been swapped with the msgstr part down there.  How can I do it? 
Also, there are multiple lines where I should apply this, and sometimes in front of the | you can find other letters or characters. 
I was thinking about this:
([|].*)  for the first part, but then I don't know how to find the msgstr (that it never changes). 
Edit:
Here's other example of the code I'm talking about. 
translate italian ch1_669664cb:| mc

# "Hey." 
msgstr "Hey." 

translate italian ch1_177d3eb2:| mc

# "What are you doing?" 
msgstr "What are you doing?" 

translate italian ch1_25d98ea6:| m p_1a

# "I'm in charge of the breakfast, remember?" 
msgstr "I'm in charge of the breakfast, remember?" 

translate italian ch1_7ae83e04:|

# "Oh, that's right." 
msgstr "Oh, that's right." 

I want it swapped like this:
translate italian ch1_669664cb:msgstr 

# "Hey." 
| mc "Hey." 

translate italian ch1_177d3eb2:msgstr 

# "What are you doing?" 
| mc"What are you doing?" 

translate italian ch1_25d98ea6:msgstr 

# "I'm in charge of the breakfast, remember?" 
| m p_1a"I'm in charge of the breakfast, remember?" 

translate italian ch1_7ae83e04:msgstr 

# "Oh, that's right." 
|"Oh, that's right." 

As you can see, sometimes there's something in front of the | but sometimes there's not. 

A:

One option is to use 4 capturing groups and switch group 4 and 2 in the replacement
^(.*)(\|.*)(\n(?:(?!msgstr).*\n)*)(msgstr)

^ Start of string
(.*)  Capture group 1, match any char 0+ times
(\|.*)  Capture group 2 from the last occurrence of | until the end of the string in group 2
(\n(?:(?!msgstr).*\n)*) Capture group 3, match all lines that don't start with msgstr
(msgstr) Capture group 4, match msgstr

Replace with
$1$4$3$2

Regex demo

