I need help a with building a regex for extracting a particular string and manipulating it. Here's the example
Actual Input:
( 12s ) Agent K: Hello Guest, How are you doing today?<br> <br>How Can I help<br>
( 18s ) Guest: Hello there! Need access to XYZ<br>
( 53s ) Agent K: Granted the access<br>
( 1m 9s ) Guest: Ok thanks, Agent K<br>
I want to identify the appearances of "Agent K:", "Guest:" and all timings coming within brackets and manipulate it to
<b>Agent K:</b>.12s Hello Guest, How are you doing today?<br> <br>How Can I help<br>
<b>Guest:</b>.18s Hello there! Need access to XYZ<br>
<b>Agent K:</b>.53s Granted the access<br>
<b>Guest:</b>.1m 9s Ok thanks, Agent K<br>
I started writing regex function to identify the appearances of ) Agent K: and ) Guest: so that I'm uniquely identifying their places. For that, I'm using below which returns true
string htmlValue = '<br>( 15s ) Agent K: Test Message from user';
string s1 = ') Agent K:';
Boolean found = Pattern.compile('(?i)' + Pattern.quote(s1)).matcher(htmlValue).find();
But I'm not sure how I can move next to start manipulating it. Any help is greatly appreciated!