import java.util.regex.*;
/*
 * CoolFire
 * Opdracht 6.1
*/
public class Main {
    public static void main(String[] args) {
        // The string we'll be looking at
        String toMatch = "0800-123455";
 
        boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false, found6 = false;
 
        // Define our search patterns
        Pattern pattern1 = Pattern.compile(".31[1-9]\\d[1-9]\\d\\d\\d\\d\\d\\d"); // Java doesn't allow escaping the '+' symbol for some reason. That's what you get for using regex in java instead of Perl.
        Pattern pattern2 = Pattern.compile("0[1-9]\\d-[1-9]\\d\\d\\d\\d\\d\\d");
        Pattern pattern3 = Pattern.compile("0[1-9]\\d[1-9]\\d\\d\\d\\d\\d\\d");
        Pattern pattern4 = Pattern.compile("0[1-9]\\d\\d-[1-9]\\d\\d\\d\\d\\d");
        Pattern pattern5 = Pattern.compile("06-[1-9]\\d\\d\\d\\d\\d\\d\\d");
        Pattern pattern6 = Pattern.compile("06[1-9]\\d\\d\\d\\d\\d\\d\\d");
 
        Matcher matcher1 = pattern1.matcher(toMatch);
        Matcher matcher2 = pattern2.matcher(toMatch);
        Matcher matcher3 = pattern3.matcher(toMatch);
        Matcher matcher4 = pattern4.matcher(toMatch);
        Matcher matcher5 = pattern5.matcher(toMatch);
        Matcher matcher6 = pattern6.matcher(toMatch);
 
        while (matcher1.find()) {found1 = true;}
        while (matcher2.find()) {found2 = true;}
        while (matcher3.find()) {found3 = true;}
        while (matcher4.find()) {found4 = true;}
        while (matcher5.find()) {found5 = true;}
        while (matcher6.find()) {found6 = true;}
 
        if(found1 || found2 || found3 || found4 || found5 || found6) System.out.println("Valid phone number");
        else System.out.println("No valid phone number was detected!");
    }
}