Regex Pattren issue in NodeJS



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to convert my PHP code into NodeJS



I am getting null with following NodeJS attempt



matches = data.match(/@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si/);


But in PHP, The following line working fine for me



preg_match_all('@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si', $content, $adress_link);


Sample Data



data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"









share|improve this question



















  • 2





    @ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:25












  • What about si flags?

    – Dev Hub
    Nov 15 '18 at 13:26






  • 1





    You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:27












  • @WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

    – Dev Hub
    Nov 15 '18 at 13:30











  • You have not mentioned anything about how it should work. And see my previous comment.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:33

















1















I am trying to convert my PHP code into NodeJS



I am getting null with following NodeJS attempt



matches = data.match(/@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si/);


But in PHP, The following line working fine for me



preg_match_all('@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si', $content, $adress_link);


Sample Data



data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"









share|improve this question



















  • 2





    @ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:25












  • What about si flags?

    – Dev Hub
    Nov 15 '18 at 13:26






  • 1





    You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:27












  • @WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

    – Dev Hub
    Nov 15 '18 at 13:30











  • You have not mentioned anything about how it should work. And see my previous comment.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:33













1












1








1








I am trying to convert my PHP code into NodeJS



I am getting null with following NodeJS attempt



matches = data.match(/@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si/);


But in PHP, The following line working fine for me



preg_match_all('@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si', $content, $adress_link);


Sample Data



data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"









share|improve this question
















I am trying to convert my PHP code into NodeJS



I am getting null with following NodeJS attempt



matches = data.match(/@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si/);


But in PHP, The following line working fine for me



preg_match_all('@objid="(.*?)" href="(.*?)" data-autoplay="(.*?)"@si', $content, $adress_link);


Sample Data



data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"






php node.js regex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 14:22







Dev Hub

















asked Nov 15 '18 at 13:24









Dev HubDev Hub

9419




9419







  • 2





    @ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:25












  • What about si flags?

    – Dev Hub
    Nov 15 '18 at 13:26






  • 1





    You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:27












  • @WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

    – Dev Hub
    Nov 15 '18 at 13:30











  • You have not mentioned anything about how it should work. And see my previous comment.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:33












  • 2





    @ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:25












  • What about si flags?

    – Dev Hub
    Nov 15 '18 at 13:26






  • 1





    You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:27












  • @WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

    – Dev Hub
    Nov 15 '18 at 13:30











  • You have not mentioned anything about how it should work. And see my previous comment.

    – Wiktor Stribiżew
    Nov 15 '18 at 13:33







2




2





@ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

– Wiktor Stribiżew
Nov 15 '18 at 13:25






@ are regex delimiters, in JS, you can only use /. And remove s flag and replace each .*? with [^"]*. And add g modifier to match all occurrences.

– Wiktor Stribiżew
Nov 15 '18 at 13:25














What about si flags?

– Dev Hub
Nov 15 '18 at 13:26





What about si flags?

– Dev Hub
Nov 15 '18 at 13:26




1




1





You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

– Wiktor Stribiżew
Nov 15 '18 at 13:27






You may still keep i flag. If you need to access groups, you can't use String#match(/r/g), you need to run RegExp#exec in a loop.

– Wiktor Stribiżew
Nov 15 '18 at 13:27














@WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

– Dev Hub
Nov 15 '18 at 13:30





@WiktorStribiżew /objid="([^"]*)" href="([^"]*)" data-autoplay="([^"]*)"/gi this is still not working for me, please correct me

– Dev Hub
Nov 15 '18 at 13:30













You have not mentioned anything about how it should work. And see my previous comment.

– Wiktor Stribiżew
Nov 15 '18 at 13:33





You have not mentioned anything about how it should work. And see my previous comment.

– Wiktor Stribiżew
Nov 15 '18 at 13:33












1 Answer
1






active

oldest

votes


















1














You may use



/objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i


and grab Group 1. See the regex demo.



Details




  • objid=" - literal text


  • [^"]* - 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • href=" - literal text


  • ([^"]*) - Group 1: 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • data-autoplay= - literal text.

JS demo:






var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);








share|improve this answer


















  • 1





    Thanks, its working fine

    – Dev Hub
    Nov 15 '18 at 14:56











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320495%2fregex-pattren-issue-in-nodejs%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You may use



/objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i


and grab Group 1. See the regex demo.



Details




  • objid=" - literal text


  • [^"]* - 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • href=" - literal text


  • ([^"]*) - Group 1: 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • data-autoplay= - literal text.

JS demo:






var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);








share|improve this answer


















  • 1





    Thanks, its working fine

    – Dev Hub
    Nov 15 '18 at 14:56















1














You may use



/objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i


and grab Group 1. See the regex demo.



Details




  • objid=" - literal text


  • [^"]* - 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • href=" - literal text


  • ([^"]*) - Group 1: 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • data-autoplay= - literal text.

JS demo:






var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);








share|improve this answer


















  • 1





    Thanks, its working fine

    – Dev Hub
    Nov 15 '18 at 14:56













1












1








1







You may use



/objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i


and grab Group 1. See the regex demo.



Details




  • objid=" - literal text


  • [^"]* - 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • href=" - literal text


  • ([^"]*) - Group 1: 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • data-autoplay= - literal text.

JS demo:






var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);








share|improve this answer













You may use



/objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i


and grab Group 1. See the regex demo.



Details




  • objid=" - literal text


  • [^"]* - 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • href=" - literal text


  • ([^"]*) - Group 1: 0+ chars other than "


  • " - a " char


  • s+ - 1+ whitespaces


  • data-autoplay= - literal text.

JS demo:






var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);








var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);





var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&amp;st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&amp;st.mq=2&amp;st.mvid=293001169457&amp;st.ip=182.185.185.173&amp;st.dla=on&amp;st.exp=1542464401749&amp;st.hls=off&amp;_prevCmd=movieLayer&amp;tkn=6519" data-autoplay="1"><img src="//pimg.mycdn.me/getImage?url=http%3A%2F%2Fvdp.mycdn.me%2FgetImage%3Fid%3D142641728249%26idx%3D8%26thumbType%3D32%26f%3D1&amp;type=VIDEO_S_368&amp;signatureToken=gO17aWVQ5f69KKvIJCtsDQ" alt="Video" class="vdo thumb"/><div class="vdo playb"></div><div class="vd_tmr">2:18:57</div></a><div class="vdospinner"></div></div></div></div></div></div><div class="mvtxt card"><div class="a-menu toggle"><input class="a-menu_control tgl-cbox" type="checkbox" hidden="hidden" checked="checked" autocomplete="off" id="m-1542291601750-1"></input><div class="a-menu_content_w tgl-toggled" aria-hidden="true"';
var rx = /objid="[^"]*"s+href="([^"]*)"s+data-autoplay=/i;
var match = rx.exec(s);
if (match)
console.log(match[1]);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 14:44









Wiktor StribiżewWiktor Stribiżew

330k16149231




330k16149231







  • 1





    Thanks, its working fine

    – Dev Hub
    Nov 15 '18 at 14:56












  • 1





    Thanks, its working fine

    – Dev Hub
    Nov 15 '18 at 14:56







1




1





Thanks, its working fine

– Dev Hub
Nov 15 '18 at 14:56





Thanks, its working fine

– Dev Hub
Nov 15 '18 at 14:56



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53320495%2fregex-pattren-issue-in-nodejs%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo