function autoLink(element) {
    if (_hasParentThatShouldBeIgnored(element)) {
      return element;
    }

    if (element === element.ownerDocument.documentElement) {
      element = element.ownerDocument.body;
    }

    return _parseNode(element);
  }
revision 1:
   /(\S+\.{1}[^\s\,\.\!]+)/g

revision 2:
   /(\b(((https?|ftp):\/\/)|(www\.))[-A-Z0-9+&@#\/%?=~_|!:,.;\[\]]*[-A-Z0-9+&@#\/%=~_|])/gim

put this in the beginning if you don't wan't to match within a word
   (^|[\>\(\{\[\s\>])