HTML2Text Menggunakan Regular Expression

lagi nyoba2 iseng pake java, kali aja bermanfaat.. ๐Ÿ™‚


public class Html2TextWithRegExp {
   private Html2TextWithRegExp() {}
   public static void main (String[] args) throws Exception{
     StringBuilder sb = new StringBuilder();
     BufferedReader br = new BufferedReader(new FileReader("java-new.html"));
     String line;
     while ( (line=br.readLine()) != null) {
       // or
       //  sb.append(line).append(System.getProperty("line.separator"));
     String nohtml = sb.toString().replaceAll("\\<.*?>","");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s