I have a line in this form:
url("http://www.example.com/imgs/backgrounds/bg80.jpg") repeat scroll 10% 0% transparent
This is from the CSS style for a specific element that is not currently displayed on the page. I need to preload this background image, but for this I need a url and I'm trying to write its regular expression.
I know that part of http://www.example.com/imgs/backgrounds/ remains constant, the only thing that changes is the image name itself, which can end with either .jpg or .png .
This was one attempt:
(http:\/\/www.example.com\/imgs\/backgrounds\/)[\w\.\-]*
The problem is that only part of http://www.example.com/imgs/backgrounds/ selected. So I tried this, but it does not work at all!
(http:\/\/www.example.com\/imgs\/backgrounds\/)[\w\.\-]*(.jpg|.png)
What am I doing wrong? Thanks for any help!
javascript css regex
Sean bone
source share