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
Post a Comment