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;
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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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
|
show 8 more comments
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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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
2
@
are regex delimiters, in JS, you can only use/
. And removes
flag and replace each.*?
with[^"]*
. And addg
modifier to match all occurrences.
– Wiktor Stribiżew
Nov 15 '18 at 13:25
What aboutsi
flags?
– Dev Hub
Nov 15 '18 at 13:26
1
You may still keepi
flag. If you need to access groups, you can't useString#match(/r/g)
, you need to runRegExp#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
|
show 8 more comments
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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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
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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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
php node.js regex
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 removes
flag and replace each.*?
with[^"]*
. And addg
modifier to match all occurrences.
– Wiktor Stribiżew
Nov 15 '18 at 13:25
What aboutsi
flags?
– Dev Hub
Nov 15 '18 at 13:26
1
You may still keepi
flag. If you need to access groups, you can't useString#match(/r/g)
, you need to runRegExp#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
|
show 8 more comments
2
@
are regex delimiters, in JS, you can only use/
. And removes
flag and replace each.*?
with[^"]*
. And addg
modifier to match all occurrences.
– Wiktor Stribiżew
Nov 15 '18 at 13:25
What aboutsi
flags?
– Dev Hub
Nov 15 '18 at 13:26
1
You may still keepi
flag. If you need to access groups, you can't useString#match(/r/g)
, you need to runRegExp#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
|
show 8 more comments
1 Answer
1
active
oldest
votes
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"
chars+
- 1+ whitespaceshref="
- literal text([^"]*)
- Group 1: 0+ chars other than"
"
- a"
chars+
- 1+ whitespacesdata-autoplay=
- literal text.
JS demo:
var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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]);
1
Thanks, its working fine
– Dev Hub
Nov 15 '18 at 14:56
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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"
chars+
- 1+ whitespaceshref="
- literal text([^"]*)
- Group 1: 0+ chars other than"
"
- a"
chars+
- 1+ whitespacesdata-autoplay=
- literal text.
JS demo:
var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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]);
1
Thanks, its working fine
– Dev Hub
Nov 15 '18 at 14:56
add a comment |
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"
chars+
- 1+ whitespaceshref="
- literal text([^"]*)
- Group 1: 0+ chars other than"
"
- a"
chars+
- 1+ whitespacesdata-autoplay=
- literal text.
JS demo:
var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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]);
1
Thanks, its working fine
– Dev Hub
Nov 15 '18 at 14:56
add a comment |
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"
chars+
- 1+ whitespaceshref="
- literal text([^"]*)
- Group 1: 0+ chars other than"
"
- a"
chars+
- 1+ whitespacesdata-autoplay=
- literal text.
JS demo:
var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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]);
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"
chars+
- 1+ whitespaceshref="
- literal text([^"]*)
- Group 1: 0+ chars other than"
"
- a"
chars+
- 1+ whitespacesdata-autoplay=
- literal text.
JS demo:
var s = 'data-objid="293001169457" href="https://m.ok.ru/dk?st.cmd=moviePlaybackRedirect&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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&st.sig=f74e88c3bb4366f8d16afedd42c5d8e56808f175&st.mq=2&st.mvid=293001169457&st.ip=182.185.185.173&st.dla=on&st.exp=1542464401749&st.hls=off&_prevCmd=movieLayer&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&type=VIDEO_S_368&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]);
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
@
are regex delimiters, in JS, you can only use/
. And removes
flag and replace each.*?
with[^"]*
. And addg
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 useString#match(/r/g)
, you need to runRegExp#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