Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package zpliku;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.io.*;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- /**
- *
- * @author Olaf
- */
- public class olaf {
- public static void main(String[] args) throws IOException {
- FileReader plik = new FileReader("X:/Index.html");
- BufferedReader bufor = new BufferedReader(plik);
- try {
- String c;
- Pattern p = Pattern.compile("[0-9]{3}\\s[0-9]{2}\\s[0-9]{2}");
- Pattern p2 = Pattern.compile("charset=(.){1,11}>$");
- Pattern p3 = Pattern.compile("dr\\s|mgr\\s");
- Pattern p4 = Pattern.compile("<span style=.font-size:12px;.>");
- int i = 0;
- String wypis = null;
- //String wypis2 = null;
- while ((c = bufor.readLine()) != null) {
- Matcher m = p.matcher(c);
- Matcher k = p2.matcher(c);
- Matcher n = p3.matcher(c);
- Matcher o=p4.matcher(c);
- if (n.find()) {
- i++;
- String[] temp = c.split("</span>");
- String wypisz[] = temp[0].split("12px;.>");
- wypis = wypisz[1];
- //System.out.println(i + " " + wypisz[1]);
- }
- //while (n.find()){
- if (m.find()) {
- String[] temp2 = c.split("(telefon:)");
- String wypisz2[] = temp2[1].split("</span>");
- wypis = wypis+" "+wypisz2[0];
- System.out.println(wypis);
- }
- /*
- if(o.find()) {
- System.out.println(c);
- } */
- if (k.find()) {
- String[] temp;
- temp = c.split("(charset=)");
- String wypisz[] = temp[1].split(".>");
- System.out.println(wypisz[0]);
- }
- // String koniec[] = new String[20];
- // koniec[0] = wypis + " " + wypis2;
- // if (koniec != null) {
- // System.out.println(koniec[0]);
- // }
- }
- } catch (MalformedURLException e) {
- System.err.println("zly adres" + args[0]);
- } catch (IOException e) {
- System.err.println(e);
- }
- }
- }
Add Comment
Please, Sign In to add comment