Regular Expressions 101

Community Patterns

Search tags "a" and get link and text from tags

1

Regular Expression
PCRE (PHP <7.3)

/
<(?:\s?)[aA].*?href=[\'\"](?<link>.*?)[\'\"].*?>(?<text>.*)<(?:\s?)\/(?:\s?)[aA](?:\s?)>
/
gmi

Description

Search group "link=>text" in tags "a"

Submitted by Andy - 9 years ago