contenteditable realtime replace youtube url

Posted by pimz on Stack Overflow See other posts from Stack Overflow or by pimz
Published on 2010-04-27T08:54:29Z Indexed on 2010/04/27 11:03 UTC
Read the original article Hit count: 239

Filed under:
|
|

so the problem is, i have a contenteditable div, with a keyup function binded. everytime somebody puts a youtube url in it, it has to be replaced by an embedded movie.

i came up with a regex like this :

content.match(/http:\/\/\w{0,3}.?youtube+\.\w{2,3}\/watch\?v=.*?(?=\s)/g);

firefox wil do the replace after a whitespace, but in ie it won't work.

any suggestions? thnx in advance!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript