Java tutorial
//package com.java2s; import java.util.regex.Pattern; public class Main { private static final Pattern ICAO_GPS_PATTERN = Pattern.compile("(([^@]*)@)?" + "([0-8][0-9])([0-5][0-9])([0-5][0-9])([NSns])" + "([01][0-9][0-9])([0-5][0-9])([0-5][0-9])([EWew])"); public static boolean isGPSCoordinate(String coords) { return coords.contains("&") || ICAO_GPS_PATTERN.matcher(coords).matches(); } }