import java.io.*;


public class rtf {
	private File fileEntree;
	private File fileSortie;
	private String REGEX = "\\{[^\\;]+\\;\\}|\\\\[^ ]+[ ]+|\\{|\\}|[0-9a-fA-F]{127}|[0-9a-fA-F]{12}";
	private String REGEX2 = "^\\.*;\\";
	private String REPLACE = "";

	public rtf(String in, String out){
		this.fileEntree = new File(in);
		this.fileSortie = new File(out);
		
	}
	
	//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 void test2() throws IOException{
		FileWriter fw2 = new FileWriter(this.fileSortie);
		BufferedWriter bw2 = new BufferedWriter(fw2);
		FileReader fr2 = new FileReader(this.fileEntree);
		BufferedReader br2 = new BufferedReader(fr2);
		String line = br2.readLine();
		while((line=br2.readLine())!=null){
			String newline = line.replaceAll(this.REGEX2,this.REPLACE);
			bw2.write(newline);
		}
		br2.close();
		bw2.close();
	}

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

@@ -84,16 +84,17 @@
 Sortie;%0A
+%0A
 %09private
@@ -108,16 +108,68 @@
  REGEX =
+ %22%5C%5C%5C%5C(par)%5C%5CW%7C%5C%5C%5C%5C(pard)%22;%0A%09private String REGEX2 =
  %22%5C%5C%7B%5B%5E%5C
@@ -261,47 +261,152 @@
 EGEX
-2
+3
  = %22%5E%5C%5C
+%5C%5C
 .*;%5C%5C
-%22;%0A%09private String REPLACE
+%5C%5C%7C%5C%5C%5C%5C%5B%5E %5D+%5B%5C%5Cw+%5C%5Cd*%5D%22;%0A%09private String REGEX4 = %22.*%5C%5C;.*%5Ba-zA-a%5D*%5C%5C;%22;%0A%09private String REPLACE = %22%5Cn%22;%0A%09private String REPLACE2
  = %22
@@ -945,385 +945,129 @@
 %0A%09%09%09
-bw.write(newline);%0A%09%09%7D%0A%09%09br.close();%0A%09%09bw.close();%0A%09%7D%0A%09%0A%09public void test2() throws IOException%7B%0A%09%09FileWriter fw2 = new FileWriter(this.fileSortie);%0A%09%09BufferedWriter bw2 = new BufferedWriter(fw2);%0A%09%09FileReader fr2 = new FileReader(this.fileEntree
+newline = newline.replaceAll(this.REGEX2,this.REPLACE2
 );%0A%09%09
+%09
-BufferedReader br2 = new BufferedReader(fr2);%0A%09%09String line = br2.readLine();%0A%09%09while((line=br2.readLine())!=null)%7B%0A%09%09%09String 
+newline = newline.replaceAll(this.REGEX3, this.REPLACE2);%0A%09%09%09
 newl
@@ -1064,32 +1064,35 @@
 );%0A%09%09%09newline = 
+new
 line.replaceAll(
@@ -1093,34 +1093,35 @@
 ceAll(this.REGEX
-2,
+4, 
 this.REPLACE);%0A%09
@@ -1120,16 +1120,17 @@
 LACE
+2
 );%0A%09%09%09bw
 2.wr
@@ -1125,17 +1125,16 @@
 );%0A%09%09%09bw
-2
 .write(n
@@ -1150,17 +1150,16 @@
 %09%09%7D%0A%09%09br
-2
 .close()
@@ -1164,17 +1164,16 @@
 ();%0A%09%09bw
-2
 .close()
@@ -1176,16 +1176,18 @@
 se();%0A%09%7D
+%0A%09
 %0A%0A%09publi
@@ -1347,73 +1347,8 @@
 ();%0A
-%09%09rtf test2 = new rtf(%22test.rtf%22, %22test2.rtf%22);%0A%09%09test2.test2();%0A
 %09%7D%0A%7D

Update rtf.java