开发者

Special Character Check using java pattern?

Please get me the code for saving a-z,A-Z,0-9 also below mention characters

• . period • , comma • ? question mark • ! excl开发者_如何学Goamation point • - dash * • _ underscore • ( ) parentheses • : colon • ; semicolon • $ dollar sign • asterisk • © copyright symbol • ® registered symbol • § section symbol • @ ampersand • / \ forward and back slashes • Ó acute character • Ç French cedille

please help out...


use \\(four times) for \


here's an example to check email via regex

        String fieldValue="allss@homtial.com";
        String expression = "^[a-zA-Z0-9._-+$]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$";
        CharSequence inputStr = fieldValue.trim();
        Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(inputStr);
        boolean match=false;

        if( matcher.matches()){
          match=true;
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜