Please help to build regex for d.tube to extract channel_id and video_id from  url
Following urls possible
https://d.tube/v/channel_id/video_id
https://d.tube/#!/v/channel_id/video_id
https://emb.d.tube/#!/channel_id/video_id
Please help to build regex for d.tube to extract channel_id and video_id from  url
Following urls possible
https://d.tube/v/channel_id/video_id
https://d.tube/#!/v/channel_id/video_id
https://emb.d.tube/#!/channel_id/video_id
 
    
    This should capture them two groups: https:\/\/(?:emb)?\.?d.tube\/v?(?:#!)?\/?v?\/?(\w+)\/(\w+)
It firstly matches https then the two forward slashes, which require the \ escape character.
Optionally, it gets emb, then optionally a . then d.tube, optionally /v, optionally #!, optionally another /, optionally another v and / then two capture groups which take alpha numeric characters, split by a /.
 
    
    I have posted a comment to explain my point, but here are two (possible!) different versions of what you would want:
https:\/\/(?:\w+\.)?d.tube\/.*?\/([^\/]*)\/([^\/]*)\n
And then this would extract the channel_id' and thevideo_id` from the URL:  NOTE: This answer is partially copied from this stack-overflow answer: How do you access the matched groups in a JavaScript regular expression?
var myString = myURL;
var myRegexp = /https:\/\/(?:\w+\.)?d.tube\/.*?\/([^\/]*)\/([^\/]*)\n/g;
var match = myRegexp.exec(myString);
console.log("Channel ID: " + match[0] + "\n" + "Video ID:" + match[1] + "\n");
Here is a screen-capture generated by http://regexr.com (pretty useful utiliity)

While this solution here would verify that you had valid "d.tube" URL's
https:\/\/(?:\w+\.)?d.tube\/.*?\/channel_id/video_id\n
var myString = myURL;
var myRegexp = /https:\/\/(?:\w+\.)?d.tube\/.*?\/channel_id/video_id\n/;
var match = myRegexp.exec(myString);
var isMatch = match != null;