Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String GPS_LAT_REGULAR = "^(-?((90)|((([0-8]\\d)|(\\d{1}))(\\.\\d+)?)))$"; public static boolean isGpsLat(String gpsLat) { Pattern p = Pattern.compile(GPS_LAT_REGULAR); Matcher m = p.matcher(gpsLat); return m.matches(); } }