title: Trying to replace link with hyperlink in textarea using javascript gives array error
body: <p>Whenever user type in textarea and post some link in it, I immediately want to change it to link like stackoverflow.com does here whenever anyone types <a href="https://stackoverflow.com/?q=and+message+continues+till+end">https://stackoverflow.com/?q=and+message+continues+till+end</a> but whenever anyone will pass any non-link text it will come back to text look...</p>
  
  <p>here is my try, what i have done, before i post it below , let me tell you i am not javascript student, i am just trying to cut paste and use my other programming logic and trying to make it happen. So, whenever you reply, consider my no-solid-javascript background.</p>
  
  <p>Thanks</p>
  
  <p>My Try below :-</p>
  
  <pre><code>function isUrl(s) {
      var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&amp;%@!\-\/]))?/
          return regexp.test(s);
      }
  
  $('#status').keyup(function() {
      var value = $("#status").val();
      var words = value.split(" ");
      for (var i=0;i&lt;words.length;i++)
      {
          var n = isUrl(words[i]);
          if (n)  {
              var deadLink = '&lt;a href="'+words[i]+'" target="_blank" rel="nofollow"&gt;'+words[i]+'&lt;/a&gt;';
              words[i].replace(words[i], deadLink);
          }
      }
  });
  </code></pre>
  
  <p>and this is not working, I am not getting any error here, but when i use it without array indexing like below I am getting array error:-</p>
  
  <pre><code>for (var i=0;i&lt;words.length;i++)
  {
      var n = isUrl(words);
      if (n)  {
      var deadLink = '&lt;a href="http://google.com/search?q='+words+'" target="_blank" rel="nofollow"&gt;'+words+'&lt;/a&gt;';
      words.replace(words, deadLink);
      }
  }
  </code></pre>
  
  <p>Any way to fix it ?</p>
  
  <p>Thanks</p>