如何从MySql中的一行中获取所有img src?

时间:2018-09-11 18:47:06

标签: html mysql sql

使用当前的MySql查询能够从第一个src标签中获取img

查询:

SELECT substr(substr(textfield , locate('src="', textfield ) + 5), 1, 
                     locate('"', substr(textfield , locate('src="', textfield ) + 5)) - 1) as 'imgurl' 
from pages where field1 ='data' and field2 = 'nothing';

需要获取一行单元格中所有src标签中的所有img

示例:

表列具有idtext

文本字段具有

some random content <img src='https://www.fakeurl.com/folder/image.jpeg'> 
and also <img src="https://www.fakeurl.com/folder/image.jpg"> and also <img 
src='/folder/image.jpeg'> and some additional content

需要使用MySQL中的srctextfieldquery从此function列中提取所有procedure

需要的结果是:

https://www.fakeurl.com/folder/image.jpeg
https://www.fakeurl.com/folder/image.jpg
/folder/image.jpeg

需要修改什么才能获得结果,或使用其他查询?

0 个答案:

没有答案