Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- FileReader fr = new FileReader("D:\\JAVA\\PPJ\\zajecia\\javac.txt");
- StringBuilder sb = new StringBuilder();
- int b = 0;
- while((b = fr.read())!=-1){
- sb.append((char)b);
- }
- //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})";
- 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}))";
- Pattern p = Pattern.compile(regex);
- Matcher m = p.matcher(sb);
- System.out.print("Czy data sie zgadza?:"+" "+m.matches());
- }
- catch(IOException e){
- System.out.println("IOException");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement