Jump to content

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
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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