BandonRandon Posted September 23, 2008 Share Posted September 23, 2008 Hello, So I've been trying to create a Lifestream http://blog.bandonrandon.com/lifestream for myself. I have found the feed url to my facebook mini feed but i feel that facebook gives away to much information for a public feed. A friend told me to use yahoo pipes http://pipes.yahoo.com/pipes/ which will let me modify the feeds content. Well it works great but I have a unique regex problem for someone. The feed will output data like this: # FirstName LastName accepted your friend request. # FirstName LastName wrote on your Wall. # FirstName LastName wrote on your Wall. and so on and so fourth. I would like this to read # Someone accepted My Name's friend request. # Someone wrote on My Name's Wall. # Someone wrote on My Name's Wall. one of the pipes operators is regex where i can replace variables. I am still very new to regex and am getting better but still need to be coached on it. Thanks, Brandon Link to comment https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/ Share on other sites More sharing options...
effigy Posted September 23, 2008 Share Posted September 23, 2008 Assuming they use PCRE: <pre> <?php $data = <<<DATA # FirstName LastName accepted your friend request. # FirstName LastName wrote on your Wall. # FirstName LastName wrote on your Wall. DATA; echo preg_replace('/^(.+?)(?=accepted|wrote)/m', 'Someone ', $data); ?> </pre> You can use str_replace to exchange "your" with your name, since it should be static Link to comment https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/#findComment-648650 Share on other sites More sharing options...
BandonRandon Posted September 23, 2008 Author Share Posted September 23, 2008 Thanks for the help, I was able to get the static field corrected but wasn't able to get the first name/ last name corrected. Any help would be great! Link to comment https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/#findComment-648960 Share on other sites More sharing options...
effigy Posted September 23, 2008 Share Posted September 23, 2008 According to the vague docs, try this: replace [ ^(.+?)(?=accepted|wrote) ] with [ Someone ] Link to comment https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/#findComment-648982 Share on other sites More sharing options...
BandonRandon Posted September 23, 2008 Author Share Posted September 23, 2008 Thank you that worked! I agree that the pipes documentation isn't the best. It's actually a pretty cool thing though. Brandon Link to comment https://forums.phpfreaks.com/topic/125439-solved-yahoo-pipes-meets-facebook/#findComment-649039 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.