regex - JAVA email message - clip quoted lines -
is there java library clip quoted text email message?
if it's html message, used html parser far , removed blockquotes dom tree have more trouble plain text format.
i tried regex:
emailbody = emailbody.replaceall("\n>[^\n]*?\n", "\n");
but i'm far mastering it, though there has solution since it's problem concerning more people guess. code above replaces lines new lines (after \n) , beginning >, not containing other new lines long there other content , ending \n. think replacement should done starting end of message, , on. it's bit more complicated line of code.
so welcome!
cheers, balázs
do right consider each line starts >
char quoted line?
here's quick solution:
string[] lines = emailbody.split("\n"); stringbuilder clippedemailbuilder = new stringbuilder(); (string line:lines) if (!line.startswith(">")) clippedemailbuilder.append(line); emailbody = clippedemailbuilder.tostring();
Comments
Post a Comment