I'm agreed that regex is simple, but I really don't understand why it can't find and extract data. Also, I have very little experience with Java, may be it's the cause.
Method 1
String access_token = Utils.extractPattern(url, "access_token=([a-z0-9]+)&");
Url is like https://oauth.vk.com/blank.html#access_token=abcedefasdasdasdsadasasasdads123123&expires_in=0&user_id=1111111111
Utils
public static String extractPattern(String string, String pattern) {
Pattern searchPattern = Pattern.compile(pattern);
Matcher matcher = searchPattern.matcher(string);
Log.d("pattern found - ", matcher.matches() ? "yes" : "no");
return matcher.group();
}
Why it fails with java.lang.IllegalStateException: No successful match so far
?