JSFiddle - React, Tailwind, and code Playground
JavaScript
var arrayString = 'apple | ape | soap',
text = "This a nice apple tree.";
var array = arrayString.split(" | ");
var matchedArrayItem = "..."; // please help on this
if(matchedArrayItem) {
$("body").append('The text contains the array item "'+ matchedArrayItem +'".');
}
$("body").append("<br><br>" + arrayString + "<br>" + text);