title: How to replace tags with links to lowercase tags search results?
body: <p>There is a text, for example:</p>
  
  <pre><code>&gt; This is a Car
  </code></pre>
  
  <p>And a dynamic list of tags. For example:</p>
  
  <pre><code>c, car
  </code></pre>
  
  <p>Expected result is to get this after processing:</p>
  
  <pre><code>This is a &lt;a href='car.ly?search=car'&gt;Car&lt;/a&gt;
  </code></pre>
  
  <p>So:</p>
  
  <ol>
  <li>It should replace tags with links to search results to these tags</li>
  <li>Longer tags should have prority over shorter tags</li>
  <li>It should not replace tags inside "to phrase", for example "c" in "car.ly" etc.</li>
  <li>search term should be lower case, and title letter case of the tag the same as the original </li>
  <li>It should ommit tags and styling features in input text (it can contain HTML)</li>
  </ol>
  
  <p>I have tested several solutions and no success with it. What is the proper way to handle this case? How to replace tags with a links to search results properly?</p>