i developing mail retriever retrieving needed mails , further extracting details mails using regex. have extract name, requirement etc. details following mail. how regex?? please me this. in advance.
lead details caller name: mr rahul rajouri garden caller requirement: money exchangers caller phone: +918459761134 caller email: rchand.rahul@gmail.com call date & time: tue, 18 jun 2013 14:40:38 branch info: rajouri garden city: delhi
try this, can take input file.
public class test { public static void main(string[] args) { string data = " lead details\n" + "caller name: mr rahul rajouri garden\n" + "caller requirement: money exchangers\n" + "caller phone: +918459761134\n" + "caller email: rchand.rahul@gmail.com\n" + "call date & time: tue, 18 jun 2013 14:40:38\n" + "branch info: rajouri garden\n" + "city: delhi"; string[] substr=data.split("\n"); (string i:substr){ if(i.contains("caller name")){ system.out.println("caller name: "+i.split(":")[1]); }if(i.contains("caller requirement")){ system.out.println("caller requirement: "+i.split(":")[1]); }if(i.contains("caller phone")){ system.out.println("caller phone: "+i.split(":")[1]); }if(i.contains("caller email")){ system.out.println("caller email: "+i.split(":")[1]); }if(i.contains("call date & time")){ system.out.println("call date & time: "+i.split(":")[1]); }if(i.contains("branch info")){ system.out.println("branch info: "+i.split(":")[1]); }if(i.contains("city")){ system.out.println("city: "+i.split(":")[1]); } } } }
Comments
Post a Comment