title: How can I check if something is a URL in VueJS?
body: <p>I'm trying to check if a user-input text is a URL in VueJS. I'm not sure how to do this/what the regex would be! Could someone help? This is my code currently!</p>
  <pre><code>    function isValidWebUrl(url) {
    let regEx = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&amp;//=]*)$/gm;
    return regEx.test(url);
  }
  
  &lt;div v-if = &quot;regEx.test(post.postMarkdown)&quot;&gt;
    &lt;a&gt;{{post.postMarkdown}}&lt;/a&gt;
  &lt;/div&gt;
  &lt;div v-else&gt;
    &lt;p&gt;{{ post.postMarkdown }}&lt;/p&gt;
  &lt;/div&gt; --&gt;
  </code></pre>