content: import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  public class Example {
      public static void main(String[] args) {
          final String regex = "((0?9)|(\\+?989))((14)|(13)|(12)|(19)|(18)|(17)|(15)|(16)|(11)|(10)|(90)|(91)|(92)|(93)|(94)|(95)|(96)|(32)|(30)|(33)|(35)|(36)|(37)|(38)|(39)|(00)|(01)|(02)|(03)|(04)|(05)|(41)|(20)|(21)|(22)|(23)|(31)|(34)|(9910)|(9911)|(9913)|(9914)|(9999)|(999)|(990)|(9810)|(9811)|(9812)|(9813)|(9814)|(9815)|(9816)|(9817)|(998))\\W?\\d{3}\\W?\\d{4}";
          final String string = "912 003 4965\n"
  	 + "912-003-4965\n"
  	 + "+989120034965\n"
  	 + "+98912 003 4965\n"
  	 + "+98912-003-4965\n"
  	 + "989120034965\n"
  	 + "98912 003 4965\n"
  	 + "98912-003-4965";
          
          final Pattern pattern = Pattern.compile(regex);
          final Matcher matcher = pattern.matcher(string);
          
          while (matcher.find()) {
              System.out.println("Full match: " + matcher.group(0));
              
              for (int i = 1; i <= matcher.groupCount(); i++) {
                  System.out.println("Group " + i + ": " + matcher.group(i));
              }
          }
      }
  }
  