RegEx to extract URL from CSS background styling

前端 未结 5 1701
Happy的楠姐
Happy的楠姐 2021-02-03 11:03

I have a string in this form:

url(\"http://www.example.com/imgs/backgrounds/bg80.jpg\") repeat scroll 10% 0% transparent

This is from a CSS sty

5条回答
  •  说谎
    说谎 (楼主)
    2021-02-03 11:31

    I just do it now and I get to this page so I think so my pattern its simply and absolutely:

    /url(?:\([\'"\s]?)((?!data|http|\/\/)(\.\.?\/|\/))(.*?)(?:[\'"\s]?\))/g

提交回复
热议问题