问题
I am trying this code in android for catching (.+?) with matcher.group(1):
String html = doc.html().toString();
Pattern p = Pattern.compile("(?is)caption\"(?is):(?is)\"(.+?)\",(?is)\"",
Pattern.DOTALL);
Matcher m = p.matcher(html);
if (m.find()){
text_main = m.group(1);
}
but sometimes it doesn't work. I think it can be caused by incode. so:
- If I think true, what can i do for this problem?(make regex for utf-8)
- If I'm wrong, so what can i do?. I'm trying to get a string in a json object. the json code is placed in a script in a html page.
来源:https://stackoverflow.com/questions/33738547/android-regex-pattern-incode-utf-8