Help - Search - Member List - Calendar
Full Version: Remove links from a string
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Philip Seeger
Hi everybody.

Can anybody tell me how I can take all hyperlinks out of a string?
Example: I have a string like this: 'blah blah bubble <a
href="http://www.google.com/">googling's funny</a> bubble blah'.
And it should transformed to 'blah blah bubble googling's funny bubble
blah'.

Thanx already!

--
Philip Seeger

Hilarion
Philip Seeger wrote:
QUOTE
Can anybody tell me how I can take all hyperlinks out of a string?

You can try experimenting with "strip_tags" function.

Hilarion

Phil
Philip Seeger wrote:

QUOTE
Hi everybody.

Can anybody tell me how I can take all hyperlinks out of a string?
Example: I have a string like this: 'blah blah bubble <a
href="http://www.google.com/">googling's funny</a> bubble blah'.
And it should transformed to 'blah blah bubble googling's funny bubble
blah'.

strip_tags()

Philip Seeger
That works, thank you very much!

Philip

"Hilarion" <[Email Removed]> schrieb im Newsbeitrag
news:dauk1k$sb$[Email Removed]...
QUOTE
Philip Seeger wrote:
Can anybody tell me how I can take all hyperlinks out of a string?

You can try experimenting with "strip_tags" function.

Hilarion


Stefan Rybacki
Phil wrote:
QUOTE
Philip Seeger wrote:


Hi everybody.

Can anybody tell me how I can take all hyperlinks out of a string?
Example: I have a string like this: 'blah blah bubble <a
href="http://www.google.com/">googling's funny</a> bubble blah'.
And it should transformed to 'blah blah bubble googling's funny bubble
blah'.


strip_tags()

While strip_tags() removes all html tags from a string this is perhaps not that what the

OP wants. I guess he is more looking for a regular expression like this:

/<a.*>|</a>/iu

Regards
Stefan


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.