MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

public class MainClass {
    public static void main(String args[]) {
        String addr = "my Address 12345";
        String namePattern = "([A-Za-z])+ (([A-Za-z])+\\.? )?([A-Za-z])+\\s*";

        String zipCodePattern = "\\d{5}(-\\d{4})?";
        String addressPattern = "^" + namePattern + "\\w+ .*, \\w+ " + zipCodePattern + "$";

        System.out.println(addr.matches(addressPattern));

    }
}