Guest User

Untitled

a guest
Jun 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.57 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package zpliku;
  6.  
  7. import java.io.IOException;
  8. import java.net.MalformedURLException;
  9. import java.io.*;
  10. import java.util.regex.Matcher;
  11. import java.util.regex.Pattern;
  12.  
  13. /**
  14.  *
  15.  * @author Olaf
  16.  */
  17. public class olaf {
  18.  
  19.     public static void main(String[] args) throws IOException {
  20.         FileReader plik = new FileReader("X:/Index.html");
  21.         BufferedReader bufor = new BufferedReader(plik);
  22.  
  23.         try {
  24.  
  25.             String c;
  26.             Pattern p = Pattern.compile("[0-9]{3}\\s[0-9]{2}\\s[0-9]{2}");
  27.             Pattern p2 = Pattern.compile("charset=(.){1,11}>$");
  28.             Pattern p3 = Pattern.compile("dr\\s|mgr\\s");
  29.             Pattern p4 = Pattern.compile("<span style=.font-size:12px;.>");
  30.             int i = 0;
  31.             String wypis = null;
  32.             //String wypis2 = null;
  33.             while ((c = bufor.readLine()) != null) {
  34.  
  35.                 Matcher m = p.matcher(c);
  36.                 Matcher k = p2.matcher(c);
  37.                 Matcher n = p3.matcher(c);
  38.                 Matcher o=p4.matcher(c);
  39.  
  40.                 if (n.find()) {
  41.                     i++;
  42.                     String[] temp = c.split("</span>");
  43.                     String wypisz[] = temp[0].split("12px;.>");
  44.                     wypis = wypisz[1];
  45.                     //System.out.println(i + " " + wypisz[1]);
  46.                 }
  47.                 //while (n.find()){
  48.                 if (m.find()) {
  49.  
  50.                     String[] temp2 = c.split("(telefon:)");
  51.                     String wypisz2[] = temp2[1].split("</span>");
  52.                     wypis = wypis+" "+wypisz2[0];
  53.                     System.out.println(wypis);
  54.                }
  55.                 /*
  56.                 if(o.find()) {
  57.                 System.out.println(c);
  58.                 } */
  59.                
  60.  
  61.                if (k.find()) {
  62.                     String[] temp;
  63.                     temp = c.split("(charset=)");
  64.                     String wypisz[] = temp[1].split(".>");
  65.  
  66.                   System.out.println(wypisz[0]);
  67.  
  68.  
  69.                 }
  70.               //  String koniec[] = new String[20];
  71.               //  koniec[0] = wypis + " " + wypis2;
  72.                 // if (koniec != null) {
  73.                    // System.out.println(koniec[0]);
  74.               //  }
  75.                    
  76.  
  77.                 }
  78.  
  79.         } catch (MalformedURLException e) {
  80.             System.err.println("zly adres" + args[0]);
  81.         } catch (IOException e) {
  82.             System.err.println(e);
  83.         }
  84.     }
  85. }
Add Comment
Please, Sign In to add comment