根据给定的重复文本获取正则表达式的一部分
Get part of regex based upon the given repeating text
我的正则表达式没有得到想要的结果:
(.*)"title":"(.+?)"(.*)"stream_url":"(.+?)"(.*)*
如何构建以上值正则表达式来自:
{"id":"334","title":"Al Kahera Wal Nas"
,"catchup":false,"description":"","epg_channel_id":"196","genre_id":"20","pin_required":false,"trial":true,"server_id":"8","genre":"EGYPT","logo":"https://s3-eu-west-1.amazonaws.com/static.prod/storage/26/content/56440c5f-8504-4d85-bcf8-5984ac1f2e8b-AlKaheraWalNas.jpg","stream_url":"http:\/\/lv001.cdn03.greek.zaaptv.com:80\/live\/m3u8\/Alkahera.m3u8?__token__=ip=182.186.64.249~exp=1470381422~acl=\/live\/m3u8\/Alkahera.m3u8*~hmac=7d1cabf155247a1c3e3ce03d19dcdeeea484bb86f35680d9ebf27573d114dd90"
,"stream_m3u8_url":"http://lv001.cdn03.greek.zaaptv.com:80/live/m3u8/Alkahera.m3u8?token=ip=182.186.64.249~exp=1470381422~acl=/live/m3u8/Alkahera.m3u8*~hmac=7d1cabf155247a1c3e3ce03d19dcdeeea484bb86f35680d9ebf27573d114dd90","dvr_url":""}},{"channel":{"id":"380","title":"Al Kahera Wal Nas +2"
,"catchup":false,"description":"","epg_channel_id":"197","genre_id":"20","pin_required":false,"trial":true,"server_id":"8","genre":"EGYPT","logo":"https://s3-eu-west-1.amazonaws.com/static.prod/storage/26/content/564e6db3-10bc-43ca-8e53-2ce9ac1f2e8b-AlKaheraWalNasplus2.jpg","stream_url":"http:\/\/lv001.cdn03.greek.zaaptv.com:80\/live\/m3u8\/Alkahera2.m3u8?__token__=ip=182.186.64.249~exp=1470381422~acl=\/live\/m3u8\/Alkahera2.m3u8*~hmac=b4f1d4406c973e8d5806ec88da56c035d912ec370ff84d9513a7f49218eacd06"
,"stream_m3u8_url":"http://lv001.cdn03.greek.zaaptv.com:80/live/m3u8/Alkahera2.m3u8?token=ip=182.186.64.249~exp=1470381422~acl=/live/m3u8/Alkahera2.m3u8*~hmac=b4f1d4406c973e8d5806ec88da56c035d912ec370ff84d9513a7f49218eacd06","dvr_url":""}},
试试这个:
"title":"([^"]+?)"(.*?)"stream_url":"([^"]+?)"
带有全局标志:
/"title":"([^"]+?)"(.*?)"stream_url":"([^"]+?)"/g
这对你有用吗?
"title":"([^"]+?)"(.*?)|"stream_url":"([^"]+?)"
它基于 baddger964 的答案,但修改为放置 |
以便它会分别匹配每个实例
我的正则表达式没有得到想要的结果:
(.*)"title":"(.+?)"(.*)"stream_url":"(.+?)"(.*)*
如何构建以上值正则表达式来自:
{"id":"334","title":"Al Kahera Wal Nas"
,"catchup":false,"description":"","epg_channel_id":"196","genre_id":"20","pin_required":false,"trial":true,"server_id":"8","genre":"EGYPT","logo":"https://s3-eu-west-1.amazonaws.com/static.prod/storage/26/content/56440c5f-8504-4d85-bcf8-5984ac1f2e8b-AlKaheraWalNas.jpg","stream_url":"http:\/\/lv001.cdn03.greek.zaaptv.com:80\/live\/m3u8\/Alkahera.m3u8?__token__=ip=182.186.64.249~exp=1470381422~acl=\/live\/m3u8\/Alkahera.m3u8*~hmac=7d1cabf155247a1c3e3ce03d19dcdeeea484bb86f35680d9ebf27573d114dd90"
,"stream_m3u8_url":"http://lv001.cdn03.greek.zaaptv.com:80/live/m3u8/Alkahera.m3u8?token=ip=182.186.64.249~exp=1470381422~acl=/live/m3u8/Alkahera.m3u8*~hmac=7d1cabf155247a1c3e3ce03d19dcdeeea484bb86f35680d9ebf27573d114dd90","dvr_url":""}},{"channel":{"id":"380","title":"Al Kahera Wal Nas +2"
,"catchup":false,"description":"","epg_channel_id":"197","genre_id":"20","pin_required":false,"trial":true,"server_id":"8","genre":"EGYPT","logo":"https://s3-eu-west-1.amazonaws.com/static.prod/storage/26/content/564e6db3-10bc-43ca-8e53-2ce9ac1f2e8b-AlKaheraWalNasplus2.jpg","stream_url":"http:\/\/lv001.cdn03.greek.zaaptv.com:80\/live\/m3u8\/Alkahera2.m3u8?__token__=ip=182.186.64.249~exp=1470381422~acl=\/live\/m3u8\/Alkahera2.m3u8*~hmac=b4f1d4406c973e8d5806ec88da56c035d912ec370ff84d9513a7f49218eacd06"
,"stream_m3u8_url":"http://lv001.cdn03.greek.zaaptv.com:80/live/m3u8/Alkahera2.m3u8?token=ip=182.186.64.249~exp=1470381422~acl=/live/m3u8/Alkahera2.m3u8*~hmac=b4f1d4406c973e8d5806ec88da56c035d912ec370ff84d9513a7f49218eacd06","dvr_url":""}},
试试这个:
"title":"([^"]+?)"(.*?)"stream_url":"([^"]+?)"
带有全局标志:
/"title":"([^"]+?)"(.*?)"stream_url":"([^"]+?)"/g
这对你有用吗?
"title":"([^"]+?)"(.*?)|"stream_url":"([^"]+?)"
它基于 baddger964 的答案,但修改为放置 |
以便它会分别匹配每个实例