我有以下 HTML,我希望找到当前播放的艺术家和歌曲标题我的正则表达式在http://gskinner.com/RegExr/中工作,它在 Java 中正确编译但它不匹配任何东西
HTML 片段
<div class="audio_playing_title">Currently Playing.
<div class="audio_home_box">
<div class="audio_playing_stats">
<div class="audio_playing">
<div class="audio_dj_title">PRESENTER:
AutoDJ - The Slogan
</div>
<div class="audio_track_title">SONG TITLE:
The Artist Name - Song Name
</div>
</div>
</div>
</div>
Java 代码
String data = getWebsiteData(url);
data = data.replace("\\t", "");
Pattern pat = Pattern.compile("<div class=\"audio_track_title\">SONG TITLE:\r(.+)\r</div>");
Matcher matcher = pat.matcher(data);
if (matcher.matches())
{
data = matcher.group(1);
}
else
{
System.out.println("No match");
}
return data;