SHARE
TWEET

Untitled

a guest Jan 20th, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try{
  2.             FileReader fr = new FileReader("D:\\JAVA\\PPJ\\zajecia\\javac.txt");
  3.             StringBuilder sb = new StringBuilder();
  4.             int b = 0;
  5.             while((b = fr.read())!=-1){
  6.                 sb.append((char)b);
  7.             }
  8.             //String regex = "(([0-2]{1}[0-9]{1}[-]{1})|([3]{1}[0-1]{1}[-]{1}))(([0]{1}[1-9]{1}[-]{1})|([1]{1}[0-1]{1}[-]{1}))([0-9]{4})";
  9.             String regex = "(([0-2]{1}[0-9]{1}[-]{1}[0]{1}[1-9]{1}[-]{1}[0-9]{4})|([0-2]{1}[0-9]{1}[-]{1}[1]{1}[0-2]{1}[-]{1}[0-9]{4})|([3]{1}[0-1]{1}[-]{1}[13456789]{1}[-]{1}[0-9]{4}))";
  10.                 Pattern p = Pattern.compile(regex);
  11.                 Matcher m = p.matcher(sb);
  12.                 System.out.print("Czy data sie zgadza?:"+" "+m.matches());
  13.         }
  14.         catch(IOException e){
  15.             System.out.println("IOException");
  16.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top