Jump to content

[SOLVED] Yahoo Pipes meets Facebook


BandonRandon

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.