Regular Expressions 101

Get favicon URL from HTML body

Open Workspace
  • PCRE2 (PHP)
  • Match
0

Regular Expression

/
rel=['"](?:shortcut )?icon['"] href=['"]([^?'"]+)[?'"]
/
g

Description

Looks for "shortcut icon" or "icon" in a link rel and will strip query strings.

Submitted by EcoTechie