Last active
August 29, 2015 14:04
-
-
Save saltun/e9421b8590798582ea0a to your computer and use it in GitHub Desktop.
Yazı içindeki Linkleri temizletmek
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function link_temizle($par) { | |
$desen = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i"; | |
$cevirilecek = ""; | |
return preg_replace($desen, $cevirilecek, $par); | |
} | |
echo link_temizle('ali veli uçan kaçar <a href="http://savascanaltun.com.tr/">savaş can altun </a>'); | |
// href kısmınıda sildirmek için | |
function link_temizle($par) { | |
$desen = "/<a href=\"[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+\">/i"; | |
$cevirilecek = ""; | |
return preg_replace($desen, $cevirilecek, $par); | |
} | |
echo link_temizle('ali veli uçan kaçar <a href="http://savascanaltun.com.tr/">savaş can altun </a>'); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment