Java tutorial
//package com.java2s; import android.text.TextUtils; import java.util.regex.Pattern; public class Main { private final static String CONTRACT_NAME_PATTERN = "^.*(`|~|!|@|#|\\$|%|\\^|&|\\*|\\(|\\)|_|-|\\+|=|\\{|\\}|\\[|\\]|;|:|\\.|,|/|\\?|'|\\||\"|\\\\)+.*$"; public static boolean isContractNameValid(String name) { if (!TextUtils.isEmpty(name)) { return !Pattern.matches(CONTRACT_NAME_PATTERN, name); } return true; } }