Android Regex Pattern Incode UTF-8

只愿长相守 提交于 2019-12-02 19:37:52

问题


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:

  1. If I think true, what can i do for this problem?(make regex for utf-8)
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!