Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static int getNumberOfAcceptedEvents(String response) { String patternString = "\"acc\":(\\d*)"; Pattern pattern = Pattern.compile(patternString); Matcher matches = pattern.matcher(response); if (matches.find()) { return Integer.parseInt(matches.group(1)); } return -1; } }