Create 3 variables:
@before@ @bold@ @after@

All 3 are filled using (probably the same) IF statements.

Even if the complete text is in the field, you have a way to determine when you want which variable contain (what) text. Based upon that, the IF statements fill the three variables (3rd can be empty in record 1 example).

In short: the trick is to divide into multiple variables.