Jump to content

Removing links without http://


Valleriani

Recommended Posts

Is there a specific way to search a string and remove a '.com/.etc' basicly if theres no space after the ., it would realize its a link.. like is the content was 'hello this is fun. you are now here.net here.' It would remove the here.net completely from the string.

 

Simply I'm trying to remove links without http:// the best way. Guessing it would be by tracking the ending .'whatever'

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/61048-removing-links-without-http/
Share on other sites

yes regex will work, but its over powering instead using string comparisions say something like

<?php
if(stristr($sring,"http://")){
//it has it in it at least, but we should compare if its the first five characters so
}
//this is better
if(stristr($sring,"http://") && stripos($string."http://") == 0){
//now we know it contains it and is at beging
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.