我正在尝试查找以' /'结尾的文件夹的链接例如www.w3.org/TR/owl-features/使用java正则表达式,但我无法这样做。任何helpp将不胜感激 这是我的代码
File file4 = new File("W3C Web Pages");
File[] listOfFiles4 = file4.listFiles();
for (int i = 0; i < listOfFiles4.length; i++)
{
if (listOfFiles4[i].isFile())
{
FileReader filereader = new FileReader("W3C Web Pages/"+listOfFiles4[i].getName());
BufferedReader br = new BufferedReader(filereader);
Pattern regx = Pattern.compile("(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
String text;
while ((text = br.readLine()) != null)
{
Matcher linkswslash = regx.matcher(text);
if (linkswslash.find())
{
if(linkswslash.group().contains("/"))
{
System.out.println("Found value: " + linkswslash.group());
}
}
}
}
}