Highlighting characters by their number
<p>Consider having the following string and it's numerical value:</p>

<p><img src="http://i.stack.imgur.com/YQ6Z4.png" alt="enter image description here"></p>

<p>You then allow the user to type in to a textbox: <code>1|17|7|19</code>, how would I be able to highlight the text as follows:</p>

<p><img src="http://i.stack.imgur.com/lDZeO.png" alt="enter image description here"></p>

<p>I can have it work when calculating in spaces and paragraphs, but when I completely remove all white space and new lines (e.g. "Thisissomedummytext") I cannot work out how I would go about achieving this.</p>

<p><strong>EDIT</strong></p>

<p><a href="http://jsfiddle.net/rubeE/" rel="nofollow"><strong>This</strong></a> is what I have so far, it takes into account spaces and new lines (nl's count as 1 char).</p>
