正則表達式

import static net.mindview.util.Print.*;

public class TestRegularExpress
{
   public static void main(String[] args)
   {
       String s = "a88897a";
       print(s.matches("..."));
       print(s);
       print(s.replaceAll("//d", "-"));
      
       print();
       print(" /r/n/t".matches("//s{4}"));
       print("".matches("//S"));
       print("a_8".matches("//w{3}"));
       print("abc888&^%".matches("[a-z]{1,3}//d+[&^%#]+"));
       print("//".matches("////"));
       print("192.168.25.8".matches("//d+//.//d+//.+//d.+//d+"));
      
       print();
       print("a".matches("[abc]"));
       print("a".matches("[^abc]"));
       print("A".matches("[a-zA-Z]"));
       print("A".matches("[a-z]|[A-Z]"));
       print("A".matches("[a-z[A-Z]]"));
       print("R".matches("[A-Z[RFJ]]"));
      
   }
}
   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章