Regular Expressions 101

Community Patterns

find all link(<a>) tags expect your links in href attribute

11

Regular Expression
ECMAScript (JavaScript)

/
<(a+) (?!(?:href=(["|']+)([http:\/\/])*link\.com([\/])?(.*?)["|'])) *[^>]*>(.*?)[^>]>
/
gm

Description

<a href="yourlink.com">YourLink</a> - not found <a href="anotherlink.com">AnotherLink</a> - found

Submitted by KoT - 9 years ago