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=nani@gmail.com 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 "nani@gmail.com" and print that email. like wise remaining fields. can any one send me script or url's. please its urgent. thanq Quote Link to comment 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=nani@gmail.com 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.