Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
ECMAScript (JavaScript)

/
(url\(\\?['"]?)(.*?)(\\?['"]?\))
/
ig

Description

Finds all external resources declared as url() in styles. Handles different quote types if any, even escaped ones:

  • url(...)
  • url('...')
  • url("...")
  • url(\'...\')
  • url(\"...\")
Submitted by anonymous - 2 years ago