javascript - js writes a regular expression to extract data from text
给我你的怀抱
给我你的怀抱 2017-07-05 10:43:25
0
2
719

I have a text like this:

sdsadsad

ewe.jpgewe.jpg

Use js to write regular rules to extract part of the src value of allimg tags in, and then use/@/# to extract the multiple values##Splicinginto a new string

20170701/6363450829304727881702482.jpg/@/20170701/6363450829304727881702483.jpg
给我你的怀抱
给我你的怀抱

reply all (2)
仅有的幸福
var html = '

sdsadsad

ewe.jpgewe.jpg

'; var txt = html .match(/src="([^"]*?)"/g) .map(m => m.replace(/^src="\/Edite\/net\/upload\/image\/([^"]*)"$/, '')) .join('/@/'); console.log(txt);

Effect:

    给我你的怀抱
    const html = `

    sdsadsad

    ewe.jpgewe.jpg

    `; console.log(html.match(/src="([^"]*?)"/g).map(m => m.replace('src="/Edite/net/upload/image/', '').replace(/"/g, '')).join('/@/'))

    Online experience

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!