How To Match Multiple Conditions in Regex
<p>In a previous post, I wrote about how to make YouTube links show up as thumbnails in your Medium post. In order to do it, you need to make use of some <strong><em>regular expressions</em></strong> to match and replace certain patterns in the provided URLs.</p>
<p>In the post, I included a bonus section where one might encounter two different conditions that need to be accounted for. You could do two separate statements to address both cases. Or, you can do it the clean, efficient way by incorporating multiple conditions into one regex statement.</p>
<p>In this post, I’ll dive a little more in depth on how to do this! Below, is a simple regex that can be used in conjunction with <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match" rel="noopener ugc nofollow" target="_blank">match</a></code> so that you can find whatever parts of a string meet your regex condition.</p>
<p><a href="https://levelup.gitconnected.com/how-to-match-multiple-conditions-in-regex-a380affa175e">Visit Now</a></p>