check Postcode by Regex - Java java.util.regex

Java examples for java.util.regex:Match Phone Number

Description

check Postcode by Regex

Demo Code


//package com.java2s;
import java.util.regex.Pattern;

public class Main {

    public static boolean checkPostcode(String postcode) {
        String regex = "[1-9]\\d{5}";
        return Pattern.matches(regex, postcode);
    }/*from  w  w w  .  j  a  v a2  s . c o  m*/
}

Related Tutorials