Hi,
I'm trying to extract POP3 valid email content using this regular expression.
I have removed the entire content of <script> ... </script> and <style> ... </style>.
I have converted every <br> tag into "\n".
I have removed all HTML tags and extracted all email content into a string using regular expressions such as
regex = "<[^>]*>";
(this will remove only tag & attributes not their values).
I have added extra spaces & line breaks in Compose mail
plz read this message in view page source mode in your browser. so u can understand what i need now.
Compose Mail content is:
Testing white space:
hi hello then whats up man., is it cool
The policy set up by your network administrator requires that you authenticate yourself with this firewall before you can have access. To authenticate yourself click on the following link and enter your user name and password to log in to the firewall.
Mails retrieved in pop3 as:
<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div><span style="font-family: Verdana; color: rgb(0, 0, 0); font-size: 10pt;"><span style="font-family: Verdana; color: rgb(0, 0, 0); font-size: 10pt;"><font style="font-family: Verdana;" color="#000000" size="2" face="Verdana"><font style="font-family: Verdana;" color="#000000" size="2" face="Verdana"><font style="font-family: Verdana;" color="#000000" size="2" face="Verdana"><font style="font-family: Verdana;" color="#000000" size="2" face="Verdana">Testing white space:<br>hi hello then whats up man., is it cool<br><br>The
policy set up by your network administrator requires that
you authenticate yourself with this firewall before you can have
access. To authenticate yourself click on
the following link and enter your user name and
password to log in to the firewall. </font></font></font></font></span></span></div></span></body></html>
The formatted string from above HTML code:
Testing white space:
hi hello then whats up man., is it cool
The
policy set up by your network administrator requires that
you authenticate yourself with this firewall before you can have
access. To authenticate yourself click on
the following link and enter your user name and
password to log in to the firewall.
I am removing extra white spaces into single spaces, and if there are more than two line breaks in succession, I am replacing them by 2 line breaks.
In the formatted string, I got an unwanted line break between "The" and "policy". I can't predict why it happens. I guess it is appended by POP3. Can anyone help me to format the string exactly? Thanks in advance.