What regex to match all occurrences of css urls?

后端 未结 6 2157
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-20 14:36

i have a css file with a bunch of background image urls:

.alert-01 {
  background: url(\'img/alert-01.jpg\') center no-repeat;
}
.alert-02 {
  background: url(\'         


        
6条回答
  •  春和景丽
    2021-02-20 14:57

    Try:

    /url\(.*?g'\)/ig
    

    Your mistake was including ^ and $ in the regexp, which anchors it to the beginning and end of the input string. And you forgot to allow for the quote.

提交回复
热议问题