Skip to main content

CSS_URL_REGEX

Static CSS_URL_REGEX 

Source
static CSS_URL_REGEX: LazyLock<Regex>
Expand description

Regular expression to match CSS url() functions

This regex matches:

  • url(“…”)
  • url(‘…’)
  • url(…)

It captures the URL inside the parentheses, handling:

  • Single quotes
  • Double quotes
  • No quotes
  • Escaped quotes within the URL

Examples:

  • background-image: url("./image.png");
  • background: url('/path/to/image.jpg');
  • @import url(https://example.com/style.css);
  • src: url(../fonts/font.woff2);