srinivas6203 Posted July 30, 2008 Share Posted July 30, 2008 hi all I want to print email from file. the file contains like this. time="" register=no mailserver=mail.google.com [email protected] password=xxxxxxxxxxxxxxxx status="online" From this i want to get email and print it on to the browser. i con't use line wise print. because that file will change the order every time , That means , now email row was in 4th line. after refresh the browser that email row might be go into the 2nd or last line etc. So first i want find word "email=" and then retrieve correspondent email "[email protected]" and print that email. like wise remaining fields. can any one send me script or url's. please its urgent. thanq Link to comment https://forums.phpfreaks.com/topic/117298-php-file-problem/ Share on other sites More sharing options...
JasonLewis Posted July 30, 2008 Share Posted July 30, 2008 Try this, replacing $str with the contents of the file that you select. $str = 'time="" register=no mailserver=mail.google.com [email protected] password=xxxxxxxxxxxxxxxx status="online"'; preg_match("#email=([a-zA-Z0-9\-_\.]+\@[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})#i",$str,$matches); $email = $matches[1]; echo $email; Link to comment https://forums.phpfreaks.com/topic/117298-php-file-problem/#findComment-603563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.