How to color multiple selections of text in list?

I have a number say

a=ToString[2^554]

and a list of numbers

dp=ToString/@{863, 877, 881, 883, 887}

and I wish locate all instances of those numbers in the string “a” and change the text colour of those numbers to Red.

I have tried using Style and FontColor but the first StringReplace inserts Tildes either side of the replaced number, it then won’t save the replacement as a string so the second replacement and beyond fails, any help would be appreciated.

The following shows the tildes.

StringReplace[a, dp[[1]] -> Style[dp[[1]], FontWeight -> "Bold", Red]]

Hi Paul,

The reason for this is that Style is not a String. Conver it to String.

StringReplace[a, dp[[1]] -> ToString[Style[dp[[1]], Red], StandardForm]]

To color all of them

StringReplace[a, n : dp :> ToString[Style[n, Red], StandardForm]]

There’s a ResourceFunction that does something similar: https://resources.wolframcloud.com/FunctionRepository/resources/HighlightText

Thank you Rohit and Richard, both solutions were ideal and solved my problem.

Hello Everyone,

Both solutions to this thread work really nice for me in the front end. However if I export as an xls I get this in my cells

With Richard solution:

TemplateBox[List[StyleBox["\"Key\"", Rule[FontColor, GrayLevel[0]], Rule[StripOnInput, False]], Rule[FrameStyle, None], Rule[ContentPadding, False], Rule[FrameMargins, 0], Rule[Background, RGBColor[0.99609375`, 0.92578125`, 0.328125`]]], "Highlighted"]

and with Rohit solution: VFJW

InterpretationBox[Cell[BoxData[FormBox[StyleBox["\"4\"", RGBColor[1, 0, 0], Rule[StripOnInput, False]], TextForm]], "InlineText"], Text[Style["4", RGBColor[1, 0, 0]]]]

My goal is to have something like VFJW4 with the (4) in red or other color in the same cell.

I will do this later with
“The cat is Blue”. and will like to have “Blue” in the same sentence so that the user can pick up the differences easy.

Does anyone know what is going on with the Export?

Rodrigo