Hi,
I'm setting up a link preview like fb
you know you can write a message paste
an url and see the preview.
The point is catching a url in a string
so my first thought was for a regex way
but may be it's too tricky
http://stackoverflow.com/questions/5...-url-in-a-text
peep into this other thread looking for a way to get the pasted string
http://stackoverflow.com/questions/2...he-paste-event
I ended up with this solution
PHP Code:
$('#message_link').bind({
       
paste: function() {
            var 
bPLength = $.trim($('#message_link').val()).length;
            
setTimeout(function() {
                var 
strInput = $.trim($('#message_link').val());
                var 
aPLength strInput.length;
                
log(bPLength);
                
log(aPLength);
                
log(strInput.substr(bPLength,aPLength));
               
//var xhr = YD.http.linkPreview($.trim($('#message_link').val()));
            
}, 0);
       }
    }); 
and it seems to work but I'd like to know your opinion.

Bye