You can use a regular expression based on
"mailto = (test@mail.com)"
If this is found in the stringified php, you can conveniently extract the parenthesized section.
But most likely it could be foo@bar.com
as well, and so you may have to write a more complicated regular expression, but it'll work the same way.
Here's a version matching any valid email address:
"mailto = ([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+(?:\\.[A-Za-z]){1,3}\\b)"
Perhaps the spaces before and after =
aren't guaranteed, so you might make them optional:
"mailto ?= ?(...)"
To execute the match, use
Pattern pat = Pattern.compile( "mailto = ([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+(?:\\.[A-Za-z]){1,3}\\b)" );
and, with the php in a String you can then do
String php = ...;
Matcher mat = pat.matcher( php );
if( mat.find() ){
String email = mat.group( 1 );
}
The find can be called repeatedly to find all occurrences.
See another SO Q+A for the discussion of a regular expression matching an email address.