Re: Regex Help for URL's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This one time, at band camp, "Robert Samuel White" <rsw@xxxxxxxxxxx> wrote:

> Don't be rude.  I've already don't all of that.  Nothing came up.  I've been
> programming for 20 years (since I was 11 years old) so I'm not a slacker
> when it comes to learning new things, however, I have always found regular
> expressions to be extremely difficult.  Someone here might have the answer I
> need, and if so, I'd appreciate a response.  If you don't know the answer,
> don't reply.  Simple enough, don't you think?

Sorry, I missed most of this...
>From what I gather you wish to extract urls from text?
if so..
function getLinks($string){
  // regex to get the links
  preg_match_all("|http:?([^\"' >]+)|i", $string, $arrayoflinks);
  return $arrayoflinks;
}

Also check out this on line tutorial for regex geared towards PHP
http://phpro.org/tutorials/Introduction-to-PHP-Regular-Expressions.html

Kind regards
Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux