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