Regular Expressions 101

Community Patterns

Get favicon URL from HTML body

0

Regular Expression
PCRE2 (PHP >=7.3)

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

Description

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

Submitted by EcoTechie - 2 years ago