What"s the best way to extract HTML out of $var?

What"s the best way to extract HTML out of $var?

am 15.01.2010 03:15:56 von alexus

What's the best way to extract HTML out of $var?

example of $var

$var = ""
I want

$var2 = "http://starckoverflow.com/"
example: preg_match();

what else?

--
http://alexus.org/

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

Re: What"s the best way to extract HTML out of $var?

am 15.01.2010 03:20:03 von John Meyer

On 1/14/2010 7:15 PM, alexus wrote:
> What's the best way to extract HTML out of $var?
>
> example of $var
>
> $var = ""
> I want
>
> $var2 = "http://starckoverflow.com/"
> example: preg_match();
>
> what else?
>

Actually what it looks like you want are the URLs, not the HTML. This
regular expression will match them up for you:

https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?

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

Re: What"s the best way to extract HTML out of $var?

am 15.01.2010 12:36:54 von Bruno Fajardo

2010/1/15 alexus :
> What's the best way to extract HTML out of $var?
>
> example of $var
>
> $var = ""
> I want
>
> $var2 = "http://starckoverflow.com/"
> example: preg_match();
>
> what else?

Hi,
If you simply wants to remove all tags from the string, try using the
strip_tags function (http://php.net/strip_tags).

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

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