need to replace first or second gradient color, like this:

```js
var x = 1;
var new_color = 'rgb(140,220,0)';
var sty = $('#targ').attr('style');
if(x == 1){
  var first_rgb = '???'; // regex here to get `rgb(255,102,255)`
  var new_sty = sty.replace(first_rgb, new_color);
}
else{
  var second_rgb = '???'; // regex here to get `rgb(255,0,0)`
  var new_sty = sty.replace(second_rgb, new_color);
}
$('#targ').attr('style', new_sty)
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="targ" style="background:linear-gradient(to right, rgb(255,102,255), rgb(255,0,0)); color:black; padding:25px 9px 14px 9px;">LOREM</div>
```

Any help?