簡體   English   中英

來自shoutcast流URL的Java剪切鏈接

[英]Java Cut Links from shoutcast stream url

字符串

[playlist] numberofentries = 2File1 = http://66.162.107.142/cpr1_K128OV.oggTitle1=KCFR NewsLength1 = -1File2 = http://66.162.107.141:8000 / cpr1_K128OV.oggTitle2 = KCFR新聞BackupLength2 = -1Version = 2

我想剪切此文件中的所有鏈接,如何?

使用正則表達式查找和替換URL。 請注意,這種事情充滿了危險。 發布您希望最終結果看起來像什么的示例,以獲得更好的答案。 URL是否都是IP地址?

下課

package regexpso;

import java.util.regex.*;

public class Main {

    public static void main(String[] args) {
        Pattern p = Pattern.compile("(http:.*?.ogg)");
        Matcher m = p.matcher("[playlist]numberofentries=2File1=http://66.162.107.142/cpr1_K128OV.oggTitle1=KCFR NewsLength1=-1File2=http://66.162.107.141:8000/cpr1_K128OV.oggTitle2=KCFR News BackupLength2=-1Version=2");

        while (m.find()) {
            System.out.println(m.group());
        }
    }
}

版畫

http://66.162.107.142/cpr1_K128OV.ogg http://66.162.107.141:8000/cpr1_K128OV.ogg

結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM