Please let me know if $1 can be assigned to a variable for further manipulation ? I am getting matched strings in $1 but not able to do further slicing based on the matching
I have the below string:
var result="#02080=#04217+#04217_DUP6887","#01066=(#01047+#01111+#01048+#01118+#01049+#01050+#01121+#01128+#01131+#01141+#01138+#01148+#01053+#01062+#01054+#02080+#02048+#01064+#01063+#01065+#01051+#01052+#02062+#02069+#02072+#02079)","#02002=#01066","#02007=(#02002+#02003+#02004+#02005+#02006)","#02010=(#02007+#02008+#02009)","#04216+#04216_DUP6887=#04217+#04217_DUP6887","#04215+#04215_DUP6887=#04216+#04216_DUP6887"
I have regex to match areas like
#04215+#04215_DUP1869=. My intention is to make areas like
#04215+#04215_DUP6887=#04216+#04216_DUP6887
to
#04215_DUP6887=#04216+#04216_DUP6887
In regex, I'm using pattern as below:
var regex2=new RegExp("([#][0]["+pgNo+"][0-9]{3}[+][#][0]["+pgNo+"][0-9]{3}[_][D][U][P][0-9]{4}[=])" ,"g");
result=result.toString().replace(regex2,'$1'+'rrrr');
This only appends 'rrrr' to matched places(not what I want). I need to take those matched places in $1 and slice off till '+' symbol. How can I achieve it ?