I have a text like this:
<p>sdsadsad</p><p><img src="/Edite/net/upload/image/20170701/6363450829304727881702482.jpg" title="ewe.jpg" alt="ewe.jpg"/><img src="/Edite/net/upload/image/20170701/6363450829304727881702483.jpg" title="ewe.jpg" alt="ewe.jpg"/></p>
Use js to write regular rules to extract part of the src value of all img tags in , and then use /@/# to extract the multiple values ##Splicing
into a new string
20170701/6363450829304727881702482.jpg/@/20170701/6363450829304727881702483.jpg
仅有的幸福2017-07-05 10:45:25
var html = '<p>sdsadsad</p><p><img src="/Edite/net/upload/image/20170701/6363450829304727881702482.jpg" title="ewe.jpg" alt="ewe.jpg"/><img src="/Edite/net/upload/image/20170701/6363450829304727881702483.jpg" title="ewe.jpg" alt="ewe.jpg"/></p>';
var txt = html
.match(/src="([^"]*?)"/g)
.map(m => m.replace(/^src="\/Edite\/net\/upload\/image\/([^"]*)"$/, ''))
.join('/@/');
console.log(txt);
Effect:
给我你的怀抱2017-07-05 10:45:25
const html = `<p>sdsadsad</p><p><img src="/Edite/net/upload/image/20170701/6363450829304727881702482.jpg" title="ewe.jpg" alt="ewe.jpg"/><img src="/Edite/net/upload/image/20170701/6363450829304727881702483.jpg" title="ewe.jpg" alt="ewe.jpg"/></p>`;
console.log(html.match(/src="([^"]*?)"/g).map(m => m.replace('src="/Edite/net/upload/image/', '').replace(/"/g, '')).join('/@/'))
Online experience