If the 122545;bmwx3;new;
part is not fixed
In three steps:
Get to
red,black,white,pink#LIMIT#122545;bmwx3;new;
: replace(.*;)([^;]*)
with\2#LIMIT#\1
Create the
122545;bmwx3;new;red
stings: replace(\w+)(?:,|(?=#LIMIT#))(?=.*#LIMIT#(.*))
with
\2\1\n
(see demo)Remove the
#LIMIT#...
lines: replace^#LIMIT#.*
with an empty string
If the 122545;bmwx3;new;
part is fixed
@hjpotter's idea seems pretty cool, you just new to replace ,
with
\n122545;bmwx3;new;
What's left
Replace
^(\w*);(\w*);(\w*);(\w*)$
with
INSERT INTO myTable VALUES ("\1", "\2", "\3", "\4")
You're good to go !