使用javascript删除包含未知内容的字符串

使用javascript删除包含未知内容的字符串,javascript,regex,iframe,Javascript,Regex,Iframe,我确信我必须使用正则表达式。我有以下字符串: 给你: '<iframe width="100" height="100" src="hello.html'.replace(/<iframe width=\"\d+\" height=\"\d+\" src=\"/, ''); '如果您的字符串仅包含该字符串,请使用string=string.substr(string.indexOf('src=“”)+5)@RobW将其添加为一个答案,这比regex更好。(也应该是+10以容纳扩展名

我确信我必须使用正则表达式。我有以下字符串:
给你:

'<iframe width="100" height="100" src="hello.html'.replace(/<iframe width=\"\d+\" height=\"\d+\" src=\"/, '');

'如果您的字符串仅包含该字符串,请使用
string=string.substr(string.indexOf('src=“”)+5)
@RobW将其添加为一个答案,这比regex更好。(也应该是
+10
以容纳扩展名)@Mathletics它是
+5
,因为
src=“string=string.substr(string.indexOf('src=“”)+5);string=string.substr(0,string.indexOf('”)@RobW哇!我还没喝咖啡呢。