on 04-09-2007 9:20 AM
Q 1)
i have a content content , i want to eliminate the < > ( )
it works fine for < > but not ( )
i will get this if i include the ( ) ..pls advice
java.util.regex.PatternSyntaxException: Unclosed group near index 1
(
^
Q2)
if i want to write a method to get the mail address
xxxx@xxxx.com how to i write this method and store it in a string array...
String[] strAdd =parse(newstrContent);
public class test2 {
public static void main(String[] args) {
String strContent="The original message was received at Mon, 9 Apr 2007 16:08:36 +0800" +
"----- The following addresses had permanent fatal errors -----" +
"<robinsonamerereee@hotmail.com>" +
" ----- Transcript of session follows -----" +
"... while talking to mx1.hotmail.com" +
">>> RCPT To:<robinsonamerereee@hotmail.com>" +
"<<< 550 Requested action not taken: mailbox unavailable";
String newContent=replace(strContent);
System.out.println(newContent);
}
private static String replace(String strContent){
String newstrContent = "";
newstrContent=strContent.replaceAll("<","");
newstrContent=newstrContent.replaceAll(">","");
//newstrContent=newstrContent.replaceAll("(","");
//newstrContent=newstrContent.replaceAll(")","");
System.err.println(newstrContent);
System.err.println("Mail Delivery Error Content:" +newstrContent.trim());
return newstrContent.trim();
}
}
Message was edited by:
yzme yzme
Hi Yzme,
Try to replace the following lines of code with ur commented lines:
newstrContent=newstrContent.replaceAll("//(","");
newstrContent=newstrContent.replaceAll("//)","");
Please reply if it gives any error.
Regards,
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.