I'd like to identify the characters within a string that are located relatively to a string I search for.
In other words, if I search for 'Example Text' in the below string, I'd like to identify the immediate characters that come before and after 'Example Text' and also have '<' and '>'.
For example, if I searched the below string for 'Example Text', I'd like the function to return <h3>
and </h3>
, since those are the characters that come immediately before and after it.
String = "</div><p></p> Random Other Text <h3>Example Text</h3><h3>Coachella Valley Music & Arts Festival</h3><strong>Random Text</strong>:Random Date<br/>"
` is 4 characters, while `
` is 5. What if it was ``? – MattDMo Jul 26 '15 at 23:44