Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class Test {
  2.     public static void main(String args[]){
  3.         System.out.println(this.validate("FMIS")); // return true
  4.         System.out.println(this.validate("[]pc")); // return false
  5.     }
  6.    
  7.     public static boolean validate(String name) {
  8.         return name.matches("([0-9a-zA-Z._-]+)");
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement