title: How to detect image file extension in a string with JavaScript
body: <p>I would like to know how can I detect an image in a string with JavaScript. For example, I have an input type text that has the following value, "Hey check this out <a href="https://exmaple.com/image.jpg" rel="nofollow">https://exmaple.com/image.jpg</a>" I want to wrap '<a href="https://exmaple.com/image.jpg" rel="nofollow">https://exmaple.com/image.jpg</a>' in an  tag so it can show the image right away in my site. Thank you, I tried using the split function in JavaScript but I don't know how to detect the image extension in the string.</p>