2
I have a site where I have an editor (html) only q sometimes instead of using the button to post the link people paste the link and it is in text so I am a regular expression to convert the text to link
$reply = preg_replace(
"/(?<![\>https?:\/\/|href=\"'])(?<http>(https?:[\/][\/]|www\.)([a-z]|[A-Z]|[0-9]|[\/.&?= ]|[~])*)/",
"<a href=\"$1\">$1</a>",
$reply
);
It happens that if the link has "-"
this link does not work, it cuts in "-"
But the solution does not work with this link http://cs624822.vk.me/v624822852/24ca1/KJepZpJimf0.jpg ou esse http://imworld.aufeminin.com/story/20150108/caique-laura-e-marocs-570188_w1000.jpg
– Daniel Lemes
@Daniellemes In the first link works yes, in the second did not work because it contained an underline
_
, I already updated the answer and put that too.– stderr