# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r",\s*file\s*:\s*\"?\'?([^\"\']*)"
test_str = "jwplayer(\"vplayer\").setup({sources:[{description:'82yekcjjfnp8',file:rtmp://149.202.80.234:19350/vod/mp4:01/00146/82yekcjjfnp8_n?h=h75fusefglekalhulo4ta4uxasktzhpsp4ptbjlplp7quqflff7nytwrypwq'},{description:'82yekcjjfnp8',file:\"http://149.202.80.234/h75fusefglekalhulo4ta4uxasktzhpsp4ptbjlplp7quqflff7nytwrypwq/v.mp4\"}],image:\"http://149.202.80.234/i/01/00146/82yekcjjfnp8.jpg\",duration:\"3148\",width:\"100%\",height:\"100%\",primary:\"flash\",androidhls:\"true\",startparam:\"start\",plugins:{\"http://streamplay.to/player6/lightsout.js\":{}},tracks:[],captions:{color:'#dacf84',fontSize:16,fontFamily:\"Arial\",backgroundOpacity:0},\"sharing\":{code:\"%3CIFRAME SRC%3D%22http%3A%2F%2Fstreamplay.to%2Fembed-82yekcjjfnp8.html%22 FRAMEBORDER%3D0 MARGINWIDTH%3D0 MARGINHEIGHT%3D0 SCROLLING%3DNO allowfullscreen%3D%22true%22 WIDTH%3D954 HEIGHT%3D537%3E%3C%2FIFRAME%3E\",link:\"http://streamplay.to/82yekcjjfnp8\"},rtmp:{bufferlength:5},stretching:'uniform',abouttext:'StreamPlay 6.0',aboutlink:'http://streamplay.to',logo:{file:'http://streamplay.to/favicon-48x48.png',hide:true,link:'http://streamplay.to/',margin:12}});var vvplay,vvad;var tt730250=0;var p0730250=0;jwplayer().onSeek(function(x){p0730250=-1});jwplayer().onTime(function(x){if(p0730250>0)tt730250+=x.position-p0730250;p0730250=x.position;if(0!=0&&tt730250>=0){p0730250=-1;jwplayer().stop();jwplayer().setFullscreen(false);$('#play_limit_box').show();$('div.video_ad').show()}if(5>0&&tt730250>=5&&vvad!=1){vvad=1;$('div.video_ad_fadein').fadeIn('slow')}});jwplayer().onPlay(function(x){doPlay(x)});jwplayer().onComplete(function(){$('div.video_ad').show()});jwplayer().onReady(function(){if(isPlayerReady)isPlayerReady()});function getMediaId(){return'2020'};function getDesc(){return'82yekcjjfnp8'};function sendGa(category,extra){if(typeof ga=='function')ga('send','event',category,getDesc(),getMediaId()+(extra?' '+extra:''))};function doPlay(x){$('div.video_ad').hide();if(vvplay)return;vvplay=1;$.get('http://streamplay.to/dl?op=view&file_code=82yekcjjfnp8&hash=730250-84-0-1471898347-bf33ea5e51b77e725853a3a36e6fbdf7');if(jwplayer().getPosition()==0)sendGa('Play')}"
matches = re.finditer(regex, test_str)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html