JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java SE 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:格式判斷 [Re:roytsang]
roytsang





發文: 620
積分: 1
於 2011-10-24 17:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
try try:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.regex.Pattern;                                                 
import java.util.regex.Matcher;  
public class RegexTest
{
    public static void main(String[] args)
   {
        Pattern pattern = Pattern.compile("[\p{Space}|\p{Punct}]|\p{Digit}]");
        Matcher matcher =pattern.matcher("sdfsdfsdf");
        System.out.println("result="+matcher.find());
        matcher =pattern.matcher("sdfsdl;fsdf");
        System.out.println("result="+matcher.find());
        matcher =pattern.matcher("sdfs dlfsdf");
        System.out.println("result="+matcher.find());
        matcher =pattern.matcher("sdfsdlfs,df");
        System.out.println("result="+matcher.find());
        matcher =pattern.matcher("sdf1sdlfsdf");
        System.out.println("result="+matcher.find());
        matcher =pattern.matcher("sdfsdlfsdf");
        System.out.println("result="+matcher.find());
   }
}


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
906 [已解決]java regular expression 番麥 159 2011-10-24 13:35
841 Re:格式判斷 roytsang 37 2011-10-24 13:44
836 Re:格式判斷 roytsang 37 2011-10-24 14:10
795 Re:格式判斷 roytsang 943 2011-10-24 17:24
778 Re:java regular expression 番麥 35 2011-10-25 18:29
» JWorld@TW »  Java SE 討論區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8