0

I'm currently trying to catch the css images url via regexp. I have this kind of string :

#test{background:url(images/prof_01.png);}
#test2{background:url('images/prof_01.png');}

I'm using the following exp :

/url\(("|')?(.*)("|')?\)/

to catch in both cases "images/prof_01.png". My problem is that in the #test2 example, the url comes with its last quote

images/prof_01.png'

How can I get rid of this.

Thanks.

2
  • 2
    Try url\((["']?)(.*?)\1\) regex101.com/r/UOSVAe/1 Commented Jul 9, 2020 at 10:01
  • 1
    Beautiful !! Thanks so much. Commented Jul 9, 2020 at 10:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.