PHP function for removing URLs in string





While filtering URL information within tweet, function with regular expression to find and replace it is needed. The remove_URL() function below could do exactly what I want to do:)

PHP function for removing URLs in string:

1:  <?php  
2:  $string = "100% 준비되면 하겠다는 것은 하늘나라 가서 시작하겠다는 겁니다..http://t.co/S2sTmdF45o";  
3:  echo remove_URL($string);  
4:  function remove_URL($html){  
5:    return $result = preg_replace(  
6:      '%\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))%s',  
7:      '',  
8:      $html  
9:    );  
10:  }  
11:  ?>