You could do that by
using the block editor to insert line numbers at the beginning of all lines. using a regular expression to do your replacements. removing the line numbers added in step 1.At first place the cursor to the beginning of the document (line 1, column 1) then open the Column Editor. You can find it under Edit (menu) -> Column Editor... (default shortcut ALT+C).
Choose Text to Insert, enter a SPACE character in the input field and click OK. Open the Column Editor again. Choose Number to Insert, set Initial Number to 1, set Increase by to 1, leave the Repeat field blank , choose under Format the item Dec and click OK.Now every line of your document should be preceded by its line number, separated by a SPACE character.
Now open the Find & Replace dialog. Tick the Wrap around checkbox and under Search mode choose Regular expression. In the Find what field type ^([0-9]+) (.*?x)(.*) (Note: x is your search term ) and in the Replace with field type \1 \2\1\3. Then click Replace All.
As the last step remove the line numbers by using the column editing mode. Set the cursor to the beginning of the document and press ALT+SHIFT+Down until you’ve reached the end of the document. Now you can delete the line numbers and the trailing SPACE characters by pressing the DELETE key.
The regular expression I provided above may or may not fit your needs, you have to try. If it doesn’t work come back and provide specific informations about the problem.