Java tutorial
//package com.java2s; import java.util.regex.Pattern; import java.util.regex.Pattern; public class Main { public static boolean passwordz(String input1) { String patternStr = "^((?![a-zA-Z0-9]+$)(?![^a-zA-Z/D]+$)).{6,20}$|((?![^0-9/D]+$)(?![^a-zA-Z/D]+$)).{6,20}$|((?![a-zA-Z0-9]+$)(?![^0-9/D]+$)).{6,20}$"; Pattern pattern = Pattern.compile(patternStr); return input1.matches(patternStr); } }