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 Quote 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. Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/238426-find-line-in-file/#findComment-1225309 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.