Regular Expressions

Getting some interesting results, as you can see in the attached pictures, with the following html that does not seem to render properly in the Sun’s render engine:

<o:p></o:p>
<st1:PostalCode w:st="on">33178</st1:PostalCode>

Trying to use variations of the following regular expression to get rid of <o:p></o:p> and it but can’t seem to at this point:

globals.gEmail_Body = utils.stringReplace(globals.gEmail_Body, "</o:", "</");
globals.gEmail_Body = globals.gEmail_Body.replace(/<st1:(.)>/gim ,"<span>");

Any help would be most appreciated!!!

The following works for me:

globals.gEmail_Body = globals.gEmail_Body.replace(/<o:p>/gi ,"<p>").replace(/<\/o:p>/gi ,"</p>");
globals.gEmail_Body = globals.gEmail_Body.replace(/<st1:[^>]*>/gi ,"<span>");
globals.gEmail_Body = globals.gEmail_Body.replace(/<\/st1:[^>]*>/gi ,"</span>");

You can chain replace method as much as you want…

As for the “Sun’s render engine”, this is the single worst piece of crap in the whole Swing API, the culprit’s real name is javax.swing.text.html.HTMLEditorKit.

So yes, you can blame Sun (Oracle?) for that, because every living implementation of a html editor in Java suffers from its numerous bugs, and it has never been properly fixed!

Is that not why Jeff Bader made his xhtml plugin?

Quite right Tom!

But it only handles the rendering part, not the editing part…

We all, so wait for jWebpane:
the latest blog post:

http://weblogs.java.net/blog/alex2d/arc … of_sc.html

http://weblogs.java.net/blog/alex2d/arc … rojec.html
and this
http://weblogs.java.net/blog/alex2d/arc … jec_1.html

Harjo, you are realling watching this closely, aren’t you :-)

yes, thanks to google Alerts ;-)