我有一个问题,我似乎不知道如何正确地编写正则表达式。如何编写正则表达式,例如,如果我加载了一些文本,我感兴趣的部分是以.m3u或m3u8结尾的链接。例如,如果我在程序中指定这个输入
输入-player = new Player({"player-id":"1","autoplay":"false","fullscreen":"false","debug":"true","content-volume":"85","ad-volume":"30","ad-load-timeout":"15000","div-id":"videoPlayer","default-quality-index":0,"title":"\u0428\u043f\u0438\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0435\u043d\u044f \u043a\u0438\u043d\u0443\u043b ","poster":"https://test/four/v1/video-file1/00/00/00/00/00/00/00/10/22/11/102211-480p.mp4/thumb-33000.jpg","content":{"mp4":[],"dash":"https://test/four/v1/video-file1/00/00/00/00/00/00/00/10/22/11/102211-,480,p.mp4.urlset/manifest.mpd","hls":"https://test/four/v1/video-file1/00/00/00/00/00/00/00/10/22/11/102211-,480,p.mp4.urlset/master.m3u8"},"about":"false","key":"4eeeb77181526bedc1025586d43a70fa","btn-play-pause":"true","btn-stop":"true","btn-fullscreen":"true","btn-prev-next":"false","btn-share":"true","btn-vk-share":"true","btn-twitter-share":"true","btn-facebook-share":"true","btn-google-share":"true","btn-linkedin-share":"true","quality":"true","volume":"true","timer":"true","timeline":"true","iframe-version":"true","max-hls-buffer-size":"10","time-from-cookie":"true","set-prerolls":["https://test/j/v.php?id=645"],"max-prerolls-impressions":1});
使用正则表达式,输出应该是-
https://test/four/v1/video-file1/00/00/00/00/00/00/00/10/22/11/102211-,480,p.mp4.urlset/master.m3u8
我试着写这个正则表达式,但它解析所有的链接,而不是我需要的。我只需要一个特定的标签结束tht的链接谢谢你提前回答
1条答案
按热度按时间tjvv9vkg1#
仅使用正则表达式,我在www.example.com中的解决方案ASP.net是首先反转文本,然后查找“u3m”之间的所有内容,直到下一次出现“ptth”。
m3u8或m3u的正则表达式:
ASP字符串反转(来自https://forums.asp.net/t/1841367.aspx?Reverse+String+in+asp+net):