I am trying to parse out some email header information using a regular expression. My strings will have a format that looks something like this:
String one = "The quick brown fox jumps over the fence From: First Email <[email protected]>";
String two = "Some filler text From: <[email protected]>";
I need to create a regex that will get find strings that will return "From: First Email " from the first string and "From: " from from the second string
so far this is my pattern but it is not working:
Pattern p = Pattern.compile("From: [@[\\w]+.[\\w]{2,3}]");
Currently it is only returning "From: F" and null respectively for the two strings.