I'm not positive this can be done with just regex statements, but i'm trying to prepend the first captured group onto every subsequent numeric and keep everything else the same. specifically, i have a user inputted string:
987ABC11-15; 77; 877; 66-68
everything after that "ABC"
is subject to change - it can be blank or it could be a number followed by any combination of numbers, semicolons, spaces and dashes.
i want to capture that 987ABC and prepend it to the other numbers, so that it becomes:
987ABC11-987ABC15; 987ABC77; 987ABC877; 987ABC66-987ABC68
Currently I'm trying with match string:
/^([0-9]+[A-Za-z]+)([0-9]+)*([^0-9]+)*([0-9]+)*/g
and substitution:
$1$2$3$1$4
but that's only prepending the first capture group to the first instance of the last capture group instead of all. i.e. it becomes:
987ABC11-987ABC15; 77; 877; 66-68
Any ideas?
update: i've been trying this:
/([0-9]+[A-Za-z]+)(.*)([^0-9A-Za-z]+)([0-9]+)([^0-9A-Za-z])/$1$2$3$1$4$5/
and running it multiple times, i get:
987ABC11-15; 77; 877; 987ABC66-68
987ABC11-15; 77; 987ABC877; 987ABC66-68
987ABC11-15; 987ABC77; 987ABC877; 987ABC66-68
987ABC11-987ABC15; 987ABC77; 987ABC877; 987ABC66-68
which covers everything but the 68 at the end. any idea how to modify this to do that 68 as well?