Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-01-06 10:35
Flavor·JavaScript

/
<a\s.*href\s?=\s?["'](\bmailto:\b|\bhttp:\/\/\b|\bhttps:\/\/\b).*["'].*?>.*?<\/a>
/
gi
Open regex in editor

Description

Checks for well formed <a> tags. Must include mailto, http or https. Must have quoted href. Other attribues before or after href are accepted. Must be ended with </a>

Submitted by thedotfactor