Tuesday, April 28, 2009

Re: Getting a specific URL out of a string

Sorry, make that preg_match_all(). From the manual:

PREG_SET_ORDER
Orders results so that $matches[0] is an array of first set of
matches, $matches[1] is an array of second set of matches, and so on.

http://www.php.net/manual/en/function.preg-match-all.php


On Tue, Apr 28, 2009 at 1:06 PM, Kyle Decot <kdecot9@gmail.com> wrote:
>
> What does PREG_SET_ORDER do exactly? When I use it I get a " Invalid
> flags specified" error. Thank Ideas?
>
> On Apr 28, 12:11 pm, brian <bally.z...@gmail.com> wrote:
>> This should match the URL followed by anything other than whitespace
>> or double quote.
>>
>> $pattern = '/(http:\/\/twitpic\.com[^\s\"]+)/';
>>
>> preg_match($pattern, $str, $matches, PREG_SET_ORDER);
>>
>> debug($matches);
>>
>>
>>
>> On Tue, Apr 28, 2009 at 7:54 AM, Kyle Decot <kdec...@gmail.com> wrote:
>>
>> > I know this isn't specifically a CakePHP question but I thought I
>> > would see any any of you could help me out anyways. I am getting a
>> > feed of Twitter updates and I want to check each one to see if it has
>> > ahttp://twitpic.com URL in it. How would I go about getting the
>> > TwitPic URL out of it? I know it will be some sort of regex but I am
>> > no good at them so I was hoping someone could help me out. Thanks as
>> > always for any help!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: