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 getNumberOfRejectedEvents(String response) { String patternString = "\"rej\":(\\d*)"; Pattern pattern = Pattern.compile(patternString); Matcher matches = pattern.matcher(response); if (matches.find()) { return Integer.parseInt(matches.group(1)); } return -1; } }