title: Create a regex in python match all hls url
body: <p>I have a regex to match all m3u8 URL</p>
  
  <pre><code>(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#,?&amp;*//=]*)(.m3u8)\b([-a-zA-Z0-9@:%_\+.~#,?&amp;//=]*))
  </code></pre>
  
  <p>This regex matched all m3u8 url with domain, for example: <a href="https://mydomain.example/hls/playlist.m3u8" rel="nofollow noreferrer">https://mydomain.example/hls/playlist.m3u8</a></p>
  
  <p>But I have some case need to match with url with the hostname as an IP address like, <a href="http://192.168.1.199:8001/hls/playlist.m3u8" rel="nofollow noreferrer">http://192.168.1.199:8001/hls/playlist.m3u8</a></p>
  
  <p>I find a regex for only IP matching. How can I combine regex to match all kind of hls url even it use hostname or IP</p>
  
  <p>Thanks</p>