我想给出一个基于以下格式链接分离任何字符串部分的解决方案:
Drop the Mic S02E16 1080p WEB x264-TBS ====> Drop the Mic S02E16
Hughesy We Have A Problem S03E05 720p HDTV x264-CBFM ======> Hughesy We Have A Problem S03E05
Dead of Winter S01E03 Winters Bone 1080p WEB x264-UNDERBELLY ======> Dead of Winter S01E03
Saturday Night Live S44E14 John Mulaney 720p WEB x264-TBS =====> Saturday Night Live S44E14
输入字符串不是猜测,但是所有的主题都有如下格式:"some text some text " + "S00E00" + "some text some text"
我只是想知道如何为它创建一种格式
正则表达式在这里似乎是合适的-搜索“S”,后跟一些数字,后跟“E”,后跟一些数字
结果:
如果需要单独访问标题的每个部分,则可以使用捕获组:
结果:
相关问题 更多 >
编程相关推荐