java - Finding Upper Case in String Array and extracting it out -


i have array input email id in reverse order along data:

moc.oohay@abc.pqrqwertysddd moc.oohay@ab.jklasddbfn moc.oohay@xz.jkgposddbfn 

i want output come as

moc.oohay@abc.pqr moc.oohay@ab.jkl moc.oohay@xz.jkg 

how should filter string since there no pattern?

there pattern, , upper case character followed either upper case letter, period or else @ character.

translated, become this:

string[] input = new string[]{"moc.oohay@abc.pqrqwertysddd","moc.oohay@ab.jklasddbfn" , "moc.oohay@xz.jkgposddbfn"};     pattern p = pattern.compile("([a-z.]+@[a-z.]+)");     for(string string : input)     {         matcher matcher = p.matcher(string);         if(matcher.find())             system.out.println(matcher.group(1));     } 

yields:

moc.oohay@abc.pqr moc.oohay@ab.jkl moc.oohay@xz.jkg 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -