Debug.msg(3, "Pattern2: " + m.group(2).trim());
	public static Person lookupDasOertliche(String number) {		if (number.equals("")) {			return null;		}		Debug.msg("Looking up " + number + "...");		URL url = null;		URLConnection urlConn;		DataOutputStream printout;		String data = "";		Person newPerson;		String urlstr = "http://www.dasoertliche.de/DB4Web/es/oetb2suche/home.htm?main=Antwort&s=2&kw_invers="				+ number;		try {			url = new URL(urlstr);			if (url != null) {				URLConnection con;				try {					con = url.openConnection();					String header = "";					String charSet = "";					for (int i = 0;; i++) {						String headerName = con.getHeaderFieldKey(i);						String headerValue = con.getHeaderField(i);						if (headerName == null && headerValue == null) {							// No more headers							break;						}						if ("content-type".equalsIgnoreCase(headerName)) {							String[] split = headerValue.split(" ", 2);							for (int j = 0; j < split.length; j++) {								split[j] = split[j].replaceAll(";", "");								if (split[j].toLowerCase().startsWith(										"charset=")) {									String[] charsetSplit = split[j].split("=");									charSet = charsetSplit[1];								}							}						}						header += headerName + ": " + headerValue + " | ";					}					Debug.msg("Header of dasoertliche.de: " + header);					Debug.msg("CHARSET : " + charSet);					// Get response data					BufferedReader d;					if (charSet.equals("")) {						d = new BufferedReader(new InputStreamReader(con								.getInputStream(), "ISO-8859-1"));					} else {						d = new BufferedReader(new InputStreamReader(con								.getInputStream(), charSet));					}					int i = 0;					String str = "";					while ((i < 700) && (null != ((str = d.readLine())))) {						data += str;						i++;					}					d.close();					Debug.msg("DasOertliche Webpage: " + data);					Pattern p = Pattern							.compile("<a class=\"blb\" href=\"[^\"]*\">([^<]*)</a><br>([^<]*)</td>");					Matcher m = p.matcher(data);					if (m.find()) {						Debug.msg(3, "Pattern1: " + m.group(1).trim());						Debug.msg(3, "Pattern2: " + m.group(2).trim());						String line1 = m.group(1).trim();						String line2 = m.group(2).trim();						String[] split = line1.split(" ", 2);						String firstname = "", lastname = "", company = "", address = "", zipcode = "", city = "";						lastname = split[0];						if (split.length > 1) {							firstname = " " + split[1];							Debug.msg("*" + firstname + "*"									+ firstname.indexOf("  "));							if ((firstname.indexOf("  ") > -1)									&& (firstname.indexOf("  u.") == -1)) {								company = firstname.substring(										firstname.indexOf("  ")).trim();								firstname = firstname.substring(0,										firstname.indexOf("  ")).trim();							} else {								firstname = firstname.replaceAll("  u. ",										" und ");							}						}						firstname = firstname.trim();						split = line2.split(", ", 2);						String zipcity = "";						if (split.length > 1) {							address = split[0].trim();							zipcity = split[1].trim();						} else {							zipcity = split[0].trim();							address = "";						}						split = zipcity.split(" ", 2);						if (split.length > 1) {							zipcode = split[0].trim();							city = split[1].trim();						} else {							city = split[0].trim();						}						String[] splitNames, splitAddress, splitPostCodeCity;						splitAddress = m.group(2).trim().split(",* ");						Debug.msg(splitAddress[0]);						splitPostCodeCity = splitAddress[1].split(" ", 2);						Debug.msg("Firstname: " + firstname);						Debug.msg("Lastname: " + lastname);						Debug.msg("Company: " + company);						Debug.msg("Address: " + address);						Debug.msg("ZipCode: " + zipcode);						Debug.msg("City: " + city);						newPerson = new Person(firstname, company, lastname,								address, zipcode, city, "");						if (company.length() > 0) {							newPerson.addNumber(number, "business");						} else {							newPerson.addNumber(number, "home");						}						return newPerson;					}				} catch (IOException e1) {					Debug.err("Error while retrieving " + urlstr);				}			}		} catch (MalformedURLException e) {			Debug.err("URL invalid: " + urlstr);		}		newPerson = new Person();		newPerson.addNumber(number, "home");		return newPerson;	}