Skip to content

Instantly share code, notes, and snippets.

View mfilippov's full-sized avatar

Mikhail Filippov mfilippov

  • JetBrains
  • Yerevan
View GitHub Profile
@mfilippov
mfilippov / gist:2031049
Created March 13, 2012 19:37
Postal code checker.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Program
{
public String test(String postalCode)
{
Pattern nan = Pattern.compile("\\d[A-Z]\\d");
Pattern ana = Pattern.compile("[A-Z]\\d[A-Z]");
Matcher mNan = nan.matcher(postalCode);
import java.util.Scanner;
public class Program
{
public static void Menu(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Welcome");
while(true) {
System.out.print("Please enter you ZIP(quit for exit):");