This page presents a program that generates a massive regular expression, based on the RFC grammars, for matching URLs. However, since URLs in the wild don’t necessarily follow the RFCs, a simpler regex is probably more useful.
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed