i'm working on a project that requires reordering some text. I want to use n++ with regex. Here's what I want to accomplish:
change
G0 X28.5 Y5 S0
G1 X74 S255
to
M42 P11 S0
G0 X28.5 Y5
M42 P11 S255
G1 X74
So basically not changing anything in part from G all the way to the space before S and moving the S value one line up adding the M42 P11 before it. Also there is sometimes the Y value, and both X and Y can contain dots in their values. I would really appreciate if somebody could show me how to do it using regex. Thank you.
You may want something like this
([ .\w]+)(S\d+$)$
and replace the match with M42 P11 \2\n\1
in Notepad++