Regex and matching for Soundcloud track URLS

This commit is contained in:
Zac Colley 2014-11-13 22:38:14 +00:00
parent 5b708295b5
commit 4c9380e176

View File

@ -3121,6 +3121,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var twitterRegex = /https?:\/\/twitter\.com\/.+?\/status\/\d+/i;
var facebookRegex = /https?:\/\/(?:www\.)?facebook\.com\/.+?\/posts\/\d+/i;
var gplusRegex = /https?:\/\/plus\.google\.com\/\d+\/posts\/[a-zA-Z0-9\-\_]+/i;
var soundcloudRegex = /https?:\/\/(soundcloud.com|snd.sc)\/[a-zA-Z0-9\-\_]+\/[a-zA-Z0-9\-\_]+/i;
return {
wrapRichText: wrapRichText,
@ -3266,6 +3267,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
else if (embedUrlMatches = text.match(vineRegex)) {
return ['vine', embedUrlMatches[1]];
}
else if (embedUrlMatches = text.match(soundcloudRegex)) {
return ['soundcloud', embedUrlMatches[0]];
}
if (!Config.Modes.chrome_packed) { // Need external JS
if (embedUrlMatches = text.match(twitterRegex)) {