Jump to content

Regular Expression to remove http://


Mr Chris

Recommended Posts

Hello, I'm trying to get together a regular expression to remove http:// if it exists in a url string:

 

<?php
   $web_url = "http://www.wewebbbywebsiteshere.com";
   $website = preg_replace('/^(http¦ftp¦news)s?:\/+/i', '', $web_url);
   echo $website;
?>

 

Anyone help as the above does not seem to work?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/198491-regular-expression-to-remove-http/
Share on other sites

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.