RegEXP

Password policy

at least

and 8 chars long

    (?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\p{Punct})\\p{Graph}{8}

Example:

    import java.sql.SQLException;
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;

    public class reg {

        /**
        * @param args
        * @throws SQLException
        * @throws ClassNotFoundException
        */
        public static void main(String[] args) throws SQLException, ClassNotFoundException {
          Pattern p = Pattern.compile("(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\p{Punct})\\p{Graph}{8}");
          Matcher m = p.matcher("13a!56A2");
          boolean b = m.matches();
          System.out.println(b)
        }
    }

Delete foo

lösche jede Zeile, welche eine Fileendung enhällt

    (.*?)\.(.*)$

das gleiche nur im Vim

    :g/\.\(.*\)$/d

[ Go home ]