這裏是在Mardown文本..的Javascript替換字符串
![sample text](/api/article/58933542dbac1da7eba747e0/file/58933542dbac1da7eba747e1/binary/A3DD9420-C5BA-426A-A51A-296C263440FF.png).fgfgfdgdfgdfgfg fg.<video controls poster='tempfile://827e9ff4-07ef-f9c1-a4c2-5d4f8fcb5754'><source src='tempfile://d23228e7-a683-befc-724b-96f57f5459e7' type='video/mp4'></video>
在上述字符串需要用空使用JavaScript(替換)取代
<video controls poster='tempfile://827e9ff4-07ef-f9c1-a4c2-5d4f8fcb5754'><source src='tempfile://d23228e7-a683-befc-724b-96f57f5459e7' type='video/mp4'></video>
正則表達式..
function RemoveContentText(text, link) {
return text.replace(/(!\[.*?\]\()(.+?)(\))/g, function (whole, a, b, c) {
if (whole == link) return '';
else return whole;
});
}
這裏的文字是Mardowntext,鏈接是需要被替換的字符串..
能否請您分享您的努力? – Rajesh
對於正則表達式'const regex = //g;'? –
getjackx
@getjackx感謝您的重播,但降價字符串可能包含多個視頻,因此需要標識特定的視頻並用空白替換。 –