java - how do I split email from a String -


i have string "test test <test@test.com>" need split email address if string present in format or else no need spilt. have not got solutions show approach.

i need split email address if present in above mentioned format.

you can extract email this.

import java.util.regex.matcher; import java.util.regex.pattern;  public class helloworld {      public static void main( string[] args ) {         string mydata ="test test <test@test.com>";         pattern pattern = pattern.compile(".*<(.*)>");         matcher matcher = pattern.matcher(mydata);          string email = null;         if (matcher.find())         {             email = matcher.group(1);          }          system.out.println(email);     } } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -