// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r#",\s*file\s*:\s*"?\'?([^"\']*)"#).unwrap();
let string = "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')}";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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 Rust, please visit: https://docs.rs/regex/latest/regex/