Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static Pattern PAGE_PATTERN = Pattern.compile("&page=([0-9])"); public static int getCurrentPage(String url) { Matcher matcher = PAGE_PATTERN.matcher(url); if (matcher.find()) { return Integer.parseInt(matcher.group(1)); } return 0; } }