I need to search a string, and if it has any values that match my array, I need to add <span></span> tags to them to add custom CSS. I am using reactJS.
How do I search the string for objects from my array? Example:
let string = 'this is a message with many inputs, {{input1}}, {{input2}}, and again {{input1}}' let array = [{parameter: '{{input1}}'},{parameter: '{{input2}}'},...] findAllOccurrances = () => {???}Then systematically replace them
'{{inputX}}'with<span className='bizarre-highlight'>{{inputX}}</span>
My intent is to add custom CSS to any text in the div which matches my array, so if you got any ideas please shoot! Again, using reactJS if that helps.