我有一个 json 提要,它提供用于填充日历的 html,我需要从中检索一些信息。例如标题、时间和地点。我想使用正则表达式来获取内容
<span class=\"title\">
和
<\/span><br/><b>
我正在尝试使用此代码
for(int i = 0; i < json.length(); i++)
{
JSONObject object = new JSONObject(json.getJSONObject(i));
System.out.println(object.getNames(object));
Pattern p = Pattern.compile("(?i)(<span class=\"title\">)(.+?)(<\\/span>)");
Matcher m = p.matcher(json.get(0).toString());
m.find();
System.out.println(m.group(0));
但它似乎没有做这项工作......我已经尝试了多次迭代并尝试在线研究示例,但我不确定我是否在正则表达式语法中做错了什么。帮助将不胜感激。
{"hoverContent":"<b>Title: <\/b><span class=\"title\">Accounting Awareness<\/span><br/><b>Time: <\/b><span class=\"time\">5:30 PM - 6:30 PM<br/><b>Location: <\/b><span class=\"location\">1185 Grainger Hall<\/span><br/><b>Description: <\/b><br/><span class=\"description\">Information from Kristen Fuhremann, Director of Professional Programs in Accounting and Q&A from a panel of current and former students who will share their experiences in the accounting program. Panel includes a grad of the IMAcc program currently in law school, a candidate for the IMAcc program who studied abroad, an accounting and finance double major, and an IMAcc student who is also a TA for AIS 100. Casual Attire is appropriate.<br />Contact: Natalie Dickson, <a href=\"mailto:ndickson@wisc.edu\">ndickson@wisc.edu<\/a><\/span><br/>","title":"Accounting Awareness","start":"2013-09-30 17:30:00","allDay":false,"itemId":"2356754a-8178-4afd-b4cf-7f5f5ce89868","end":"2013-09-30 18:30:00"}
无效的