Regular Expressions 101

Community Patterns

Extract Dirty `href` Values in HTML

1

Regular Expression
PCRE (PHP <7.3)

/
(?<=href=")(.+)(?="(( [a-z]+=)|>))
/
Ugm

Description

Even though using a delimiter within a string, without escaping it, is an illegal character, sometimes this still happens and we need to extract a HTML value.

Submitted by Sean O'Mahoney - 3 years ago