public void buildConnectionCSV(String outputFilename)
			throws UnsupportedEncodingException, FileNotFoundException, IOException
	{
		String regexp =
			"^\\(" +
				"\\(" + 
					"(?:\\(\\(\\(([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?(?: ([^ )]+))?\\)(?: ?([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?)\\)\\) )?" +
					"\\(\\(\\(([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?(?: ([^ )]+))?\\)(?: ?([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?)\\)\\) " +
					"\\(\\(\\(([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?(?: ([^ )]+))?\\)(?: ?([^ )]+)?(?: ([^ )]+))?(?: ([^ )]+))?)\\)\\)" +
				"\\)" +
				" (\\d+)" +
			"\\)$";

		Pattern pattern = Pattern.compile(regexp);

		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(this.inputDirectory + "/connect.cha"), this.charset));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFilename), "UTF-8"));

		String line = null;
		StringBuilder builder = new StringBuilder();


		while (((line = reader.readLine()) != null)) {

			Matcher matcher = pattern.matcher(line);
			matcher.find();

			builder.replace(0, builder.length(), "\"");
			int i;
			if (matcher.group(1) == null) {
				builder.append("*,*,*,*,*,*,*\",\"");
				i = 8;
			} else {
				i = 1;
			}

			for (; i <= 21; i++) {
				String group = matcher.group(i);
				if ((group == null) || group.equals("")) {
					builder.append("*");
				} else {
					builder.append(group);
				}
				if ((i == 7) || (i == 14)) {
					builder.append("\",\"");
				} else if (i != 21) {
					builder.append(",");				
				}
			}
			builder.append("\",");
			builder.append(matcher.group(22));
			builder.append("\n");
			writer.write(builder.toString());

		}
		writer.close();

	}