pimz
pimz

Reputation: 11

contenteditable realtime replace youtube url

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!

Upvotes: 1

Views: 540

Answers (1)

Mottie
Mottie

Reputation: 86413

I'm not the best at regex, but I did post an answer a while back about replacing youtube url text with the embeded player. Maybe it'll help?

Upvotes: 1

Related Questions