I have a plain string
"A <br> B <br/> C <br /> D <br/>"
and a set of possible substrings, like
['<br>','<br/>','<br />'];
It's trivial to find the index in the whole string of the nth occurence of a particular string in a string, so i can find the index in the whole string of the nth '<br>' or the nth '<br/>' but how it possible to find the nth occurence of any of these string?
For example, if i need the 2' occurence it would be in this case at 9' character, that is counting as first occurence the first <br> AND as second occurence the second <br/>
EDIT: Find the index of the nth occurence of a particular string can be done like this
var index = string.split('<br>', 2).join('<br>').length;
so I can find separate occurences. The problem is to find the occurence of any of these strings.