var text = 'text, text. text //i1.ytimg.com/vi/gRskt8VAc1s/default.jpg fgfsghgfg'; var f = text.match(/\/\/i1.ytimg.com\/vi\/(\w){11}\/default.jpg/i); alert(f[0]);