import java.io.*;
import java.lang.Object;
import java.util.*;
import java.util.regex.*;


public class rtf {
	private static String nomFichier = "map.csv";
	private static String destination = "final.txt";
	private static String CSV_SEPARATOR = ";";
	private File fileEntree;
	private File fileSortie;
	// Regex marche à moitié celui la marche mieux -> \{[^\;]+\;\}|\\[^ ]+[ ]+|\{|\}|^\\.*()$|[0-9a-fA-F]{127}|[0-9a-fA-F]{12} mais faut le changer pour java
	private String REGEX = "\\{[^\\;]+\\;\\}|\\\\[^ ]+[ ]+|\\{|\\}|^\\.*()|[0-9a-fA-F]{127}|[0-9a-fA-F]{12}";
	private String REPLACE = "";

	public rtf(String in, String out){
		this.fileEntree = new File(in);
		this.fileSortie = new File(out);
		
	}
	

	//I have no idea why it's here
	private String cleanline(String line, String key, String value) {
		return value;

	}
	
	//replace line by line with the regular expression
	public void test() throws IOException{
		FileWriter fw = new FileWriter(this.fileSortie);
		BufferedWriter bw = new BufferedWriter(fw);
		FileReader fr = new FileReader(this.fileEntree);
		BufferedReader br = new BufferedReader(fr);
		String line = br.readLine();
		while((line=br.readLine())!=null){
			String newline = line.replaceAll(this.REGEX,this.REPLACE);
			bw.write(newline);
		}
		br.close();
		bw.close();
		
	}

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		rtf test = new rtf("buffalo96.rtf","test.rtf");
		test.test();
	}
}

@@ -130,244 +130,133 @@
 ing 
-nomFichier = %22map.csv%22;%0A%09private static String destination = %22final.txt%22;%0A%09private static String CSV_SEPARATOR = %22;%22;%0A%09private File fileEntree;%0A%09private File fileSortie;%0A%09// Regex marche %C3%A0 moiti%C3%A9 celui la marche mieux -%3E 
+destination = %22final.txt%22;%0A%09private File fileEntree;%0A%09private File fileSortie;%0A%09private String REGEX = %22%5C
 %5C%7B%5B%5E%5C
+%5C
 ;%5D+%5C
-;
+%5C;%5C
 %5C%7D%7C%5C%5C
+%5C%5C
 %5B%5E %5D
@@ -266,21 +266,14 @@
 %5D+%7C%5C
-%7B%7C%5C%7D%7C%5E%5C%5C.*()$
+%5C%7B%7C%5C%5C%7D
 %7C%5B0-
@@ -305,39 +305,10 @@
 %7B12%7D
- mais faut le changer pour java
+%22;
 %0A%09pr
@@ -329,91 +329,24 @@
 EGEX
+2
  = %22
-%5C%5C%7B%5B%5E%5C%5C;%5D+%5C%5C;%5C%5C%7D%7C%5C%5C%5C%5C%5B%5E %5D+%5B %5D+%7C%5C%5C%7B%7C%5C%5C%7D%7C%5E%5C%5C.*()%7C%5B0-9a-fA-F%5D%7B127%7D%7C%5B0-9a-fA-F%5D%7B12%7D
+%5E%5C%5C.*%5C%5C(%5C%5C)
 %22;%0A%09
@@ -491,128 +491,8 @@
 %09%7D%0A%09
-%0A%0A%09//I have no idea why it's here%0A%09private String cleanline(String line, String key, String value) %7B%0A%09%09return value;%0A%0A%09%7D
 %0A%09%0A%09
@@ -965,16 +965,444 @@
 );%0A%09%09%0A%09%7D
+%0A%09%0A%09public void test2() throws IOException%7B%0A%09%09FileWriter fw = new FileWriter(this.fileSortie);%0A%09%09BufferedWriter bw = new BufferedWriter(fw);%0A%09%09FileReader fr = new FileReader(this.fileEntree);%0A%09%09BufferedReader br = new BufferedReader(fr);%0A%09%09String line = br.readLine();%0A%09%09while((line=br.readLine())!=null)%7B%0A%09%09%09String newline = line.replaceAll(this.REGEX2,this.REPLACE);%0A%09%09%09bw.write(newline);%0A%09%09%7D%0A%09%09br.close();%0A%09%09bw.close();%0A%09%09%0A%09%7D
 %0A%0A%09publi
@@ -1519,17 +1519,19 @@
 tf(%22
-buffalo96
+korea_final
 .rtf
@@ -1560,13 +1560,78 @@
 test();%0A
+%09%09rtf test2 = new rtf(%22test.rtf%22, %22test2.rtf%22);%0A%09%09test2.test2();%0A
 %09%7D%0A%7D%0A

Update rtf.java