Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String getRefreshToken(String url) { return extractPattern(url, "refresh_token=(.*?)(&|$)", 1); } private static String extractPattern(String string, String pattern, int group) { Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(string); if (m.find()) { return m.group(group); } else { return null; } } }