Rifts Posted June 4, 2011 Share Posted June 4, 2011 Hey guys! I'm terrible with preg_match and could use some help. I have a file and need to search through it to find these lines Amount due: $ XX.XX Payment due by: Month Day, Year how can I do this? Thanks Link to comment https://forums.phpfreaks.com/topic/238426-find-line-in-file/ Share on other sites More sharing options...
sunfighter Posted June 5, 2011 Share Posted June 5, 2011 Don't need preg_match. Open file and use file_get_contents to read entire file into a string. Then use strpos to find position of first occurrence of your lines. You could than use file_get_contents again with your newly found offset. Link to comment https://forums.phpfreaks.com/topic/238426-find-line-in-file/#findComment-1225301 Share on other sites More sharing options...
Rifts Posted June 5, 2011 Author Share Posted June 5, 2011 thanks Link to comment https://forums.phpfreaks.com/topic/238426-find-line-in-file/#findComment-1225309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.