Hi, I'm trying to do this little something into one of my CKEditor plugins:
onOk:function(){
var sInsert=this.getValueOf('info','insertcode_area');
if ( sInsert.length > 0 ) {
regex = new RegExp('(?<=\?v=)([-a-zA-Z0-9_-]+)', 'gi');
url = 'http://www.youtube.com/v/'+sInsert.match(regex);
sInsert = '<object type="application/x-shockwave-flash" data="'+url+'" width="425" height="350"><param name="movie" value="'+url+'" /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&#038;promoid=BIOW" target="blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get flash player to play to this file" width="88" height="31" /></a><br /></object>';
e.insertHtml(sInsert);
}
}
What it is supposed to do: Match the YouTube's video code into the entered URL and take it and concatenate to my url string so the URL is valid and embeddable.
But I currently get this error:
invalid quantifier ?<=?v=)([-a-zA-Z0-9_-]+)
So I supposed it is a normal error and since I don't play with regex very often maybe I never saw this one :) So if someone could help me it would be great :)
Thanks!