Regular Expressions 101

Community Patterns

Parse m3u8 IPTV playlist

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^#EXTINF:.+,\s*(?<channel>.*HD.*)$(?<bullshit>\r?\n.*)?\r?\n(?<url>^https?:\/\/.*$)
/
gmi

Description

$1 or $channel = channel name $2 or $bullshit = text to ignore $3 or $url = channel url

"HD" inside of <channel> group is search string to find all channels (with their urls) which names contain it. Feel free to play around with it.

Submitted by https://axenov.dev - 2 years ago