正則表達式截取字符串內容

正則表達式截取字符串內容

Pattern pattern = Pattern.compile("(\\{)(.+?)(\\})");
        String test = "callback( {\"client_id\":\"222222\",\"openid\":\"122121\",\"unionid\":\"ddddddddd\"} );";
        Matcher matcher = pattern.matcher(test);
        while (matcher.find()){
            System.out.println(matcher.group());
        }

部分說明:

https://www.runoob.com/regexp/regexp-metachar.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章